Defines the class MonadFailure
for monads which can fail.
- class Monad m => MonadFailure e m where
- failure :: e -> m a
- class MonadFailure e m => WrapFailure e m where
- wrapFailure :: (forall eIn. Exception eIn => eIn -> e) -> m a -> m a
- failureString :: MonadFailure StringException m => String -> m a
- newtype StringException = StringException String
Documentation
class Monad m => MonadFailure e m whereSource
Exception e => MonadFailure e IO | |
MonadFailure e [] | |
MonadFailure e Maybe | |
MonadFailure e m => MonadFailure e (ListT m) | |
Error e => MonadFailure e (Either e) | |
MonadFailure e m => MonadFailure e (StateT s m) | |
(Monoid w, MonadFailure e m) => MonadFailure e (WriterT w m) | |
MonadFailure e m => MonadFailure e (StateT s m) | |
(Monoid w, MonadFailure e m) => MonadFailure e (WriterT w m) | |
MonadFailure e m => MonadFailure e (ReaderT r m) | |
(Error e, Monad m) => MonadFailure e (ErrorT e m) | |
(Monoid w, MonadFailure e m) => MonadFailure e (RWST r w s m) | |
(Monoid w, MonadFailure e m) => MonadFailure e (RWST r w s m) |
class MonadFailure e m => WrapFailure e m whereSource
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.
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) |
failureString :: MonadFailure StringException m => String -> m aSource