Documentation

ToMathlib.Control.MonadTransformer

Monad transformers #

Taken from Zulip thread.

class MonadTransformer (t : (Type u → Type v)Type u → Type w) :
Type (max (max (u + 1) (v + 1)) w)
Instances
    @[reducible, inline]
    abbrev MonadTransformer.liftOf {t : (Type u → Type v)Type u → Type w} {α : Type u} [MonadTransformer t] (m : Type u → Type v) [Monad m] :
    m αt m α
    Equations
    Instances For
      @[reducible, inline]
      abbrev MonadTransformer.lift {t : (Type u → Type v)Type u → Type w} {α : Type u} [MonadTransformer t] {m : Type u → Type v} [Monad m] :
      m αt m α
      Equations
      Instances For
        class LawfulMonadTransformer (t : (Type u_1 → Type u_2)Type u_1 → Type u_3) [MonadTransformer t] :

        The MonadTransformer typeclass only contains the operations of a monad transformer. LawfulMonadTransformer also asserts these operations satisfy the laws of a monad transformer:

        liftOf m (pure x) = pure x
        liftOf m (x >>= f) = liftOf m x >>= liftOf m ∘ f
        
        Instances
          class MonadTransformer.IsCovariant (t : (Type u → Type v)Type u → Type w) [MonadTransformer t] :
          Type (max (max (u + 1) (v + 1)) w)

          A monad transformer is covariant if it lifts monad morphisms to monad morphisms.

          Instances