-- ------------------------------------------------------------------------
-- Exception datatypes and operations
-data ErrorCall = ErrorCall String
- deriving Typeable
-
-instance Exception ErrorCall
-
-instance Show ErrorCall where
- showsPrec _ (ErrorCall err) = showString err
-
------
-
data BlockedOnDeadMVar = BlockedOnDeadMVar
deriving Typeable
-----
--- |The type of arithmetic exceptions
-data ArithException
- = Overflow
- | Underflow
- | LossOfPrecision
- | DivideByZero
- | Denormal
- deriving (Eq, Ord, Typeable)
-
-instance Exception ArithException
-
-- |Asynchronous exceptions
data AsyncException
= StackOverflow
stackOverflow = toException StackOverflow
heapOverflow = toException HeapOverflow
-instance Show ArithException where
- showsPrec _ Overflow = showString "arithmetic overflow"
- showsPrec _ Underflow = showString "arithmetic underflow"
- showsPrec _ LossOfPrecision = showString "loss of precision"
- showsPrec _ DivideByZero = showString "divide by zero"
- showsPrec _ Denormal = showString "denormal"
-
instance Show AsyncException where
showsPrec _ StackOverflow = showString "stack overflow"
showsPrec _ HeapOverflow = showString "heap overflow"