Type classes for returning failures.
- class Failure e f where
- failure :: e -> f v
- class (Functor f, Failure e f) => FunctorFailure e f
- class (Applicative f, Failure e f) => ApplicativeFailure e f
- class (Monad f, Applicative f, Failure e f) => MonadFailure e f
- class Failure e f => WrapFailure e f where
- wrapFailure :: (forall eIn. Exception eIn => eIn -> e) -> f a -> f a
- newtype StringException = StringException String
- failureString :: Failure StringException m => String -> m a
- class Try f where
- type Error f
- try :: ApplicativeFailure (Error f) f' => f a -> f' a
- data NothingException = NothingException
- data NullException = NullException
Type classes
class (Functor f, Failure e f) => FunctorFailure e f Source
(Functor f, Failure e f) => FunctorFailure e f |
class (Applicative f, Failure e f) => ApplicativeFailure e f Source
(Applicative f, Failure e f) => ApplicativeFailure e f |
class (Monad f, Applicative f, Failure e f) => MonadFailure e f Source
(Monad f, Applicative f, Failure e f) => MonadFailure e f |
Wrapping failures
class Failure e f => WrapFailure e f whereSource
wrapFailure :: (forall eIn. Exception eIn => eIn -> e) -> f a -> f aSource
Wrap the failure value, if any, with the given function. This is useful in particular when you want all the exceptions returned from a certain library to be of a certain type, even if they were generated by a different library.
Exception e => WrapFailure e IO |
Convenience String
failure
newtype StringException Source
failureString :: Failure StringException m => String -> m aSource
Convert Failure
s into concrete types
try :: ApplicativeFailure (Error f) f' => f a -> f' aSource