definitive-base-2.6.3: A small Prelude wrapper to simplify my own Haskell developments

Safe HaskellNone
LanguageHaskell2010

Algebra.Monad.Error

Contents

Synopsis

The MonadError class

class Monad m => MonadError e m | m -> e where Source #

Minimal complete definition

throw, catch

Methods

throw :: e -> m a Source #

catch :: (e -> m a) -> m a -> m a Source #

Instances

MonadError e m => MonadError e (Free m) Source # 

Methods

throw :: e -> Free m a Source #

catch :: (e -> Free m a) -> Free m a -> Free m a Source #

Monad m => MonadError Void (ListT m) Source # 

Methods

throw :: Void -> ListT m a Source #

catch :: (Void -> ListT m a) -> ListT m a -> ListT m a Source #

Monad m => MonadError Void (LogicT m) Source # 

Methods

throw :: Void -> LogicT m a Source #

catch :: (Void -> LogicT m a) -> LogicT m a -> LogicT m a Source #

MonadError e m => MonadError e (StateT s m) Source # 

Methods

throw :: e -> StateT s m a Source #

catch :: (e -> StateT s m a) -> StateT s m a -> StateT s m a Source #

(Monoid w, MonadError e m) => MonadError e (RWST r w s m) Source # 

Methods

throw :: e -> RWST r w s m a Source #

catch :: (e -> RWST r w s m a) -> RWST r w s m a -> RWST r w s m a Source #

try :: MonadError e m => m a -> m a -> m a Source #

(!+) :: MonadError Void m => m a -> m a -> m a infixr 0 Source #

optional :: MonadError e m => m a -> m (Maybe a) Source #

The Either transformer

data EitherT e m a Source #

Instances

MonadTrans (EitherT e) Source # 

Methods

lift :: Monad m => m a -> EitherT e m a Source #

Unit m => Unit (EitherT e m) Source # 

Methods

pure :: a -> EitherT e m a Source #

MonadFix m => MonadFix (EitherT e m) Source # 

Methods

mfix :: (a -> EitherT e m a) -> EitherT e m a Source #

Traversable m => Traversable (EitherT e m) Source # 

Methods

sequence :: Applicative f => EitherT e m (f a) -> f (EitherT e m a) Source #

Foldable m => Foldable (EitherT e m) Source # 

Methods

fold :: Monoid m => EitherT e m m -> m Source #

Monad m => Monad (EitherT e m) Source # 

Methods

join :: EitherT e m (EitherT e m a) -> EitherT e m a Source #

(>>=) :: EitherT e m a -> (a -> EitherT e m b) -> EitherT e m b Source #

Applicative m => Applicative (EitherT e m) Source # 
SemiApplicative m => SemiApplicative (EitherT e m) Source # 

Methods

(<*>) :: EitherT e m (a -> b) -> EitherT e m a -> EitherT e m b Source #

Functor m => Functor (EitherT e m) Source # 

Methods

map :: (a -> b) -> EitherT e m a -> EitherT e m b Source #

eitherT :: Iso (EitherT e m a) (EitherT f m b) (m (e :+: a)) (m (f :+: b)) Source #

Orphan instances

MonadError SomeException IO Source # 

Methods

throw :: SomeException -> IO a Source #

catch :: (SomeException -> IO a) -> IO a -> IO a Source #

MonadError Void [] Source # 

Methods

throw :: Void -> [a] Source #

catch :: (Void -> [a]) -> [a] -> [a] Source #

MonadError Void Maybe Source # 

Methods

throw :: Void -> Maybe a Source #

catch :: (Void -> Maybe a) -> Maybe a -> Maybe a Source #

MonadError e (Either e) Source # 

Methods

throw :: e -> Either e a Source #

catch :: (e -> Either e a) -> Either e a -> Either e a Source #