Control.Monad.Exception.Throws
Description
Defines the Throws
binary relationship between types.
- class Exception e => Throws e l
- data Caught e l
- newtype CheckedException l = CheckedException {}
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
.
If your sets of exceptions are hierarchical then you need to
teach Throws
about the hierarchy.
- 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 thatMyFileNotFoundException
is a subexception ofMyIOException
:
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
Note that SomeException
is automatically an ancestor of every other exception type.
Instances
UncaughtException e => Throws e NoExceptions | |
Exception e => Throws e AnyException | |
Exception e => Throws e (Caught SomeException l) |
|
Exception e => Throws e (Caught e l) | |
Throws e l => Throws e (Caught e' l) | |
Throws SomeException (Caught SomeException l) | |
Throws TailFailure (Caught SafeException l) | |
Throws InitFailure (Caught SafeException l) | |
Throws HeadFailure (Caught SafeException l) | |
Throws LastFailure (Caught SafeException l) | |
Throws MinimumFailure (Caught SafeException l) | |
Throws MaximumFailure (Caught SafeException l) | |
Throws Foldr1Failure (Caught SafeException l) | |
Throws Foldl1Failure (Caught SafeException l) | |
Throws FromJustFailure (Caught SafeException l) | |
Throws IndexFailure (Caught SafeException l) | |
Throws ReadFailure (Caught SafeException l) | |
(Typeable a, Show a) => Throws (LookupFailure a) (Caught SafeException l) |
A type level witness of a exception handler.
Instances
Exception e => Throws e (Caught SomeException l) |
|
Exception e => Throws e (Caught e l) | |
Throws e l => Throws e (Caught e' l) | |
Throws SomeException (Caught SomeException l) | |
Throws TailFailure (Caught SafeException l) | |
Throws InitFailure (Caught SafeException l) | |
Throws HeadFailure (Caught SafeException l) | |
Throws LastFailure (Caught SafeException l) | |
Throws MinimumFailure (Caught SafeException l) | |
Throws MaximumFailure (Caught SafeException l) | |
Throws Foldr1Failure (Caught SafeException l) | |
Throws Foldl1Failure (Caught SafeException l) | |
Throws FromJustFailure (Caught SafeException l) | |
Throws IndexFailure (Caught SafeException l) | |
Throws ReadFailure (Caught SafeException l) | |
(Exception e, Monad m) => MonadCatch e (EMT (Caught e l) m) (EMT l m) | |
(Typeable a, Show a) => Throws (LookupFailure a) (Caught SafeException l) |
newtype CheckedException l Source
CheckedException
adds a phantom type parameter l
to SomeException
Constructors
CheckedException | |
Fields |
Instances