Copyright | (c) Alexey Kuleshevich 2020 |
---|---|
License | BSD3 |
Maintainer | Alexey Kuleshevich <[email protected]> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Control.Prim.Monad.Throw
Description
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 dependency
on the aforementioned package is because MonadCatch
and MonadMask
are not right
abstractions for exception handling in presence of concurrency and also because
instances for such transformers as MaybeT
and ExceptT
are flawed.
Methods
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.Prim.Exception's throw
.
Instances
MonadThrow Maybe Source # | |
MonadThrow IO Source # | |
MonadThrow STM Source # | |
e ~ SomeException => MonadThrow (Either e) Source # | |
MonadThrow (ST s) Source # | |
Monad 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 (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 (ReaderT r m) Source # | |
MonadThrow m => MonadThrow (IdentityT m) Source # | |
(e ~ SomeException, Monad m) => MonadThrow (ExceptT e 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 # | |
MonadThrow m => MonadThrow (RWST r w st m) Source # | |