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
    instance instMonadOfMonadTransformer {t : (Type u → Type v)Type u → Type w} {m : Type u → Type v} [MonadTransformer t] [Monad m] :
    Monad (t m)
    Equations
      @[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 → Type v)Type u → Type u_1) [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
                  instance MonadTransformer.instMonadLiftOfMonad {t : (Type u → Type v)Type u → Type w} {m : Type u → Type v} [MonadTransformer t] [Monad m] :
                  MonadLift m (t m)
                  Equations