hpastetwo

Typeable

author
malouin
age
418 days
language
haskell
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
module HackException where

import Control.Exception

-- Create a Hack-friendly exception type that includes a suggested
-- HTTP status code and an error string.
data HackException = HackException Int String deriving Typeable

instance Exception HackException

instance Show HackException where
  showsPrec _ (HackException status error) =
    showString $ concat [show status, ": ", error]

.

author
.
age
418 days
language
haskell
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
module HackException where

import Control.Exception
import Data.Typeable

-- Create a Hack-friendly exception type that includes a suggested
-- HTTP status code and an error string.
data HackException = HackException Int String deriving Typeable

instance Exception HackException

instance Show HackException where
  showsPrec _ (HackException status error) =
    showString $ concat [show status, ": ", error]


---
HackException.hs:8:55:
    Can't make a derived instance of `Typeable HackException'
      (You need -XDeriveDataTypeable to derive an instance for this class)
    In the data type declaration for `HackException'