control-monad-exception-0.8.0.2: Explicitly typed, checked exceptions with stack tracesSource codeContentsIndex
Control.Monad.Exception.Throws
Description
Defines the Throws binary relationship between types.
Synopsis
class Exception e => Throws e l
data Caught e l
newtype CheckedException l = CheckedException {
checkedException :: SomeException
}
Documentation
class Exception e => Throws e l Source

Throws is a type level binary relationship used to model a list of exceptions.

There is only one case in which the user must add further instances to Throws, and that is to encode the hierarchy of exceptions.

Subtyping
As there is no way to automatically infer the subcases of an exception, they have to be encoded manually mirroring the hierarchy defined in the defined Exception instances. For example, the following instance encodes that MyFileNotFoundException is a subexception of MyIOException :
 instance Throws MyFileNotFoundException (Caught MyIOException l)

Throws is not a transitive relation and every ancestor relation must be explicitly encoded.

                                                            --   TopException
                                                            --         |
   instance Throws MidException   (Caught TopException l)   --         |
                                                            --   MidException
   instance Throws ChildException (Caught MidException l)   --         |
   instance Throws ChildException (Caught TopException l)   --         |
                                                            --  ChildException

SomeException is automatically an ancestor of every other exception type.

show/hide Instances
data Caught e l Source
A type level witness of a exception handler.
show/hide Instances
newtype CheckedException l Source
CheckedException adds a phantom type parameter l to SomeException
Constructors
CheckedException
checkedException :: SomeException
show/hide Instances
Produced by Haddock version 2.6.0