| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Control.Monad.Error.Hoist
- class Monad m => HoistError m t e e' | t -> e where
- hoistError :: (e -> e') -> t α -> m α
- (<%?>) :: HoistError m t e e' => t α -> (e -> e') -> m α
- (<%!?>) :: HoistError m t e e' => m (t α) -> (e -> e') -> m α
- (<?>) :: HoistError m t e e' => t α -> e' -> m α
- (<!?>) :: HoistError m t e e' => m (t α) -> e' -> m α
Documentation
class Monad m => HoistError m t e e' | t -> e where Source
A tricky class for easily hoisting errors out of partiality types (e.g.
Maybe, ) into a monad. The parameter Either ee represents the error
information carried by the partiality type t, and e' represents the type
of error expected in the monad m.
Methods
hoistError :: (e -> e') -> t α -> m α Source
Given a conversion from the error in t α to e', we can hoist the
computation into m.
Instances
| MonadError e m => HoistError m Maybe () e | |
| MonadError e' m => HoistError m (Either e) e e' |
(<%?>) :: HoistError m t e e' => t α -> (e -> e') -> m α infixr 9 Source
A flipped synonym for hoistError.
(<%!?>) :: HoistError m t e e' => m (t α) -> (e -> e') -> m α infixr 9 Source
A version of <%?> that operates on values already in the monad.
(<?>) :: HoistError m t e e' => t α -> e' -> m α infixr 9 Source
A version of hoistError that ignores the error in t α and replaces it
with a new one in e'.
(<!?>) :: HoistError m t e e' => m (t α) -> e' -> m α infixr 9 Source
A version of ? that operates on values already in the monad.