primal-0.3.0.0: Primeval world of Haskell.
Copyright(c) Alexey Kuleshevich 2020
LicenseBSD3
MaintainerAlexey Kuleshevich <alexey@kuleshevi.ch>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Control.Prim.Monad.Throw

Description

 
Synopsis

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

Instances details
MonadThrow Maybe Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> Maybe a Source #

MonadThrow IO Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> IO a Source #

MonadThrow STM Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> STM a Source #

e ~ SomeException => MonadThrow (Either e) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e0 => e0 -> Either e a Source #

MonadThrow (ST s) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> ST s a Source #

Monad m => MonadThrow (MaybeT m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> MaybeT m a Source #

(Monoid w, MonadThrow m) => MonadThrow (WriterT w m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> WriterT w m a Source #

(Monoid w, MonadThrow m) => MonadThrow (AccumT w m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> AccumT w m a Source #

(Monoid w, MonadThrow m) => MonadThrow (WriterT w m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> WriterT w m a Source #

MonadThrow m => MonadThrow (WriterT w m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> WriterT w m a Source #

MonadThrow m => MonadThrow (StateT s m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> StateT s m a Source #

MonadThrow m => MonadThrow (StateT s m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> StateT s m a Source #

MonadThrow m => MonadThrow (SelectT r m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> SelectT r m a Source #

MonadThrow m => MonadThrow (ReaderT r m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> ReaderT r m a Source #

MonadThrow m => MonadThrow (IdentityT m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> IdentityT m a Source #

(e ~ SomeException, Monad m) => MonadThrow (ExceptT e m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e0 => e0 -> ExceptT e m a Source #

MonadThrow m => MonadThrow (ContT r m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> ContT r m a Source #

(Monoid w, MonadThrow m) => MonadThrow (RWST r w s m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> RWST r w s m a Source #

(Monoid w, MonadThrow m) => MonadThrow (RWST r w s m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> RWST r w s m a Source #

MonadThrow m => MonadThrow (RWST r w st m) Source # 
Instance details

Defined in Control.Prim.Monad.Throw

Methods

throwM :: Exception e => e -> RWST r w st m a Source #