Monad transformers #
Taken from Zulip thread.
instance
instMonadOfMonadTransformer
{t : (Type u → Type v) → Type u → Type w}
{m : Type u → Type v}
[MonadTransformer t]
[Monad m]
:
Monad (t m)
@[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
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)
instance
MonadTransformer.instLawfulMonadLiftOfLawfulMonadOfLawfulMonadTransformer
{t : (Type u → Type v) → Type u → Type w}
{m : Type u → Type v}
[MonadTransformer t]
[Monad m]
[LawfulMonad m]
[LawfulMonadTransformer t]
:
LawfulMonadLift m (t m)