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
- newtype StringException = StringException String
- failureString :: Failure StringException m => String -> m a
- class Try f where
- data NothingException = NothingException
- data NullException = NullException
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.