Copyright | (c) Alexey Kuleshevich 2020 |
---|---|
License | BSD3 |
Maintainer | Alexey Kuleshevich <alexey@kuleshevi.ch> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- class Monad m => MonadThrow m where
Documentation
class Monad m => MonadThrow m where Source #
A class for monads in which exceptions may be thrown.
Instances should obey the following law:
throwM e >> x = throwM e
In other words, throwing an exception short-circuits the rest of the monadic computation.
Note
This is an identical class to
MonadThrow
from exceptions
package. The reason why it was copied, instead of a direct depency on
the aforementioned package is because MonadCatch
and MonadMask
are not right
abstractions for exception handling in presence of concurrency.
throwM :: Exception e => e -> m a Source #
Throw an exception. Note that this throws when this action is run in
the monad m
, not when it is applied. It is a generalization of
Control.Exception's throwIO
.
Should satisfy the law:
throwM e >> f = throwM e
Instances
MonadThrow Maybe Source # | |
MonadThrow IO Source # | |
MonadThrow STM Source # | |
e ~ SomeException => MonadThrow (Either e) Source # | |
MonadThrow (ST s) Source # | |
MonadThrow m => MonadThrow (MaybeT m) Source # | |
(Monoid w, MonadThrow m) => MonadThrow (WriterT w m) Source # | |
(Monoid w, MonadThrow m) => MonadThrow (AccumT w m) Source # | |
(Monoid w, MonadThrow m) => MonadThrow (WriterT w m) Source # | |
MonadThrow m => MonadThrow (StateT s m) Source # | |
MonadThrow m => MonadThrow (StateT s m) Source # | |
MonadThrow m => MonadThrow (SelectT r m) Source # | |
MonadThrow m => MonadThrow (IdentityT m) Source # | |
MonadThrow m => MonadThrow (ExceptT e m) Source # | |
MonadThrow m => MonadThrow (ReaderT r m) Source # | |
MonadThrow m => MonadThrow (ContT r m) Source # | |
(Monoid w, MonadThrow m) => MonadThrow (RWST r w s m) Source # | |
(Monoid w, MonadThrow m) => MonadThrow (RWST r w s m) Source # | |