Documentation

Hale.Mtl.Control.Monad.Trans

class Control.Monad.Trans.MonadTrans (t : (TypeType)TypeType) :

The MonadTrans class abstracts the lift operation for monad transformers.

$$\text{lift} : m\ \alpha \to t\ m\ \alpha$$

Transforms a computation in the inner monad m into one in the transformed monad t m.

  • lift {m : TypeType} {α : Type} [Monad m] : m αt m α

    Lift a computation from the inner monad into the transformer.

Instances
    @[implicit_reducible]

    ExceptT lifts by wrapping the inner result in Except.ok.

    Equations
    @[implicit_reducible]

    ReaderT lifts by ignoring the environment.

    Equations
    @[implicit_reducible]

    StateT lifts by threading the state through unchanged.

    Equations
    theorem Control.Monad.Trans.readerT_lift_pure {m : TypeType} {α ρ : Type} [Monad m] (a : α) :

    ReaderT.lift preserves pure: lift (pure a) = pure a. $$\text{lift}(\text{pure}\ a) = \text{pure}\ a$$

    theorem Control.Monad.Trans.exceptT_lift_pure {m : TypeType} {α ε : Type} [Monad m] [LawfulMonad m] (a : α) :

    ExceptT.lift preserves pure: lift (pure a) = pure a. $$\text{lift}(\text{pure}\ a) = \text{pure}\ a$$

    theorem Control.Monad.Trans.stateT_lift_pure {m : TypeType} {α σ : Type} [Monad m] [LawfulMonad m] (a : α) :

    StateT.lift preserves pure: lift (pure a) = pure a. $$\text{lift}(\text{pure}\ a) = \text{pure}\ a$$