control-monad-failure-mtl-0.5.0: A class for monads which can fail with an error.

Control.Monad.Failure.Class

Description

Defines the class MonadFailure for monads which can fail.

Synopsis

Documentation

class Monad m => MonadFailure e m whereSource

Methods

failure :: e -> m aSource

Instances

class MonadFailure e m => WrapFailure e m whereSource

Methods

wrapFailure :: (forall eIn. Exception eIn => eIn -> e) -> m a -> m 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.

Instances

WrapFailure e m => WrapFailure e (ListT m) 
WrapFailure e m => WrapFailure e (StateT s m) 
WrapFailure e m => WrapFailure e (StateT s m) 
(WrapFailure e m, Monoid w) => WrapFailure e (WriterT w m) 
WrapFailure e m => WrapFailure e (ReaderT r m) 
(WrapFailure e m, Monoid w) => WrapFailure e (RWST r w s m) 
(WrapFailure e m, Monoid w) => WrapFailure e (RWST r w s m)