Idris2Doc : Control.Monad.Error.Interface

Control.Monad.Error.Interface

The Error monad (also called the Exception monad).

Definitions

interfaceMonadError : 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->ma
  Is used within a monadic computation to begin exception processing.
catchError : ma-> (e->ma) ->ma
  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
Monadm=>MonadError () (MaybeTm)
MonadErrore (Eithere)
Monadm=>MonadErrore (EitherTem)
MonadErrorem=>MonadErrore (MaybeTm)
MonadErrorem=>MonadErrore (ReaderTrm)
MonadErrorem=>MonadErrore (StateTrm)
MonadErrorem=>MonadErrore (RWSTrwsm)
MonadErrorem=>MonadErrore (WriterTwm)
throwError : MonadErrorem=>e->ma
  Is used within a monadic computation to begin exception processing.

Totality: total
Visibility: public export
catchError : MonadErrorem=>ma-> (e->ma) ->ma
  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 export
liftEither : MonadErrorem=>Eitherea->ma
  Lifts an `Either e` into any `MonadError e`.

Totality: total
Visibility: public export
tryError : MonadErrorem=>ma->m (Eitherea)
  Makes a success or failure of an action visible in
the return type.

Totality: total
Visibility: public export
withError : MonadErrorem=> (e->e) ->ma->ma
  `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 export
handleError : MonadErrorem=> (e->ma) ->ma->ma
  Flipped version of `catchError`.

Totality: total
Visibility: public export
mapError : (MonadErrorem, MonadErrore'n) => (m (Eitherea) ->n (Eithere'b)) ->ma->nb
  `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