interface MonadError : Type -> (Type -> Type) -> Type
The strategy of combining computations that can throw exceptions
by bypassing bound functions
from the point an exception is thrown to the point that it is handled.
Is parameterized over the type of error information and
the monad type constructor.
It is common to use `Either String` as the monad type constructor
for an error monad in which error descriptions take the form of strings.
In that case and many other common cases the resulting monad is already defined
as an instance of the 'MonadError' class.
Parameters: e, m
Constraints: Monad m
Methods:
throwError : e -> m a
Is used within a monadic computation to begin exception processing.
catchError : m a -> (e -> m a) -> m a
A handler function to handle previous errors and return to normal execution.
A common idiom is:
```idris example
do { action1; action2; action3 } `catchError` handler
```
Implementations:
MonadError () Maybe
Monad m => MonadError () (MaybeT m)
MonadError e (Either e)
Monad m => MonadError e (EitherT e m)
MonadError e m => MonadError e (MaybeT m)
MonadError e m => MonadError e (ReaderT r m)
MonadError e m => MonadError e (StateT r m)
MonadError e m => MonadError e (RWST r w s m)
MonadError e m => MonadError e (WriterT w m)
throwError : MonadError e m => e -> m a
Is used within a monadic computation to begin exception processing.
Totality: total
Visibility: public exportcatchError : MonadError e m => m a -> (e -> m a) -> m a
A handler function to handle previous errors and return to normal execution.
A common idiom is:
```idris example
do { action1; action2; action3 } `catchError` handler
```
Totality: total
Visibility: public exportliftEither : MonadError e m => Either e a -> m a
Lifts an `Either e` into any `MonadError e`.
Totality: total
Visibility: public exporttryError : MonadError e m => m a -> m (Either e a)
Makes a success or failure of an action visible in
the return type.
Totality: total
Visibility: public exportwithError : MonadError e m => (e -> e) -> m a -> m a
`MonadError` analogue to the `withEitherT` function.
Modify the value (but not the type) of an error.
If you need to change the type of `e` use `mapError`.
Totality: total
Visibility: public exporthandleError : MonadError e m => (e -> m a) -> m a -> m a
Flipped version of `catchError`.
Totality: total
Visibility: public exportmapError : (MonadError e m, MonadError e' n) => (m (Either e a) -> n (Either e' b)) -> m a -> n b
`MonadError` analogue of the `mapEitherT` function. The
computation is unwrapped, a function is applied to the `Either`, and
the result is lifted into the second `MonadError` instance.
Totality: total
Visibility: public export