A monad transformer that equips a monad with a value.
This is a generalization of ReaderT
where the value is not
necessarily directly readable through the monad.
Equations
- Lake.EquipT ρ m α = (ρ → m α)
Instances For
instance
Lake.instInhabitedEquipT
{ρ : Type u}
{m : Type v → Type w}
{α : Type v}
[Inhabited (m α)]
:
Inhabited (Lake.EquipT ρ m α)
Equations
- Lake.instInhabitedEquipT = { default := fun (x : ρ) => default }
@[inline]
def
Lake.EquipT.run
{ρ : Type u}
{m : Type v → Type w}
{α : Type v}
(self : Lake.EquipT ρ m α)
(r : ρ)
:
m α
Equations
- self.run r = self r
Instances For
@[inline]
def
Lake.EquipT.map
{ρ : Type u}
{m : Type v → Type w}
[Functor m]
{α β : Type v}
(f : α → β)
(self : Lake.EquipT ρ m α)
:
Lake.EquipT ρ m β
Equations
- Lake.EquipT.map f self fetch = f <$> self fetch
Instances For
instance
Lake.EquipT.instFunctor
{ρ : Type u}
{m : Type v → Type w}
[Functor m]
:
Functor (Lake.EquipT ρ m)
Equations
- Lake.EquipT.instFunctor = { map := fun {α β : Type ?u.31} => Lake.EquipT.map, mapConst := fun {α β : Type ?u.31} => Lake.EquipT.map ∘ Function.const β }
@[inline]
def
Lake.EquipT.pure
{ρ : Type u}
{m : Type v → Type w}
[Pure m]
{α : Type v}
(a : α)
:
Lake.EquipT ρ m α
Equations
- Lake.EquipT.pure a x = pure a
Instances For
@[inline]
def
Lake.EquipT.compose
{ρ : Type u}
{m : Type v → Type w}
{α₁ α₂ β : Type v}
(f : m α₁ → (Unit → m α₂) → m β)
(x₁ : Lake.EquipT ρ m α₁)
(x₂ : Unit → Lake.EquipT ρ m α₂)
:
Lake.EquipT ρ m β
Equations
- Lake.EquipT.compose f x₁ x₂ fetch = f (x₁ fetch) fun (x : Unit) => x₂ () fetch
Instances For
@[inline]
def
Lake.EquipT.seq
{ρ : Type u}
{m : Type v → Type w}
[Seq m]
{α β : Type v}
:
Lake.EquipT ρ m (α → β) → (Unit → Lake.EquipT ρ m α) → Lake.EquipT ρ m β
Equations
- Lake.EquipT.seq = Lake.EquipT.compose Seq.seq
Instances For
instance
Lake.EquipT.instApplicative
{ρ : Type u}
{m : Type v → Type w}
[Applicative m]
:
Applicative (Lake.EquipT ρ m)
Equations
- Lake.EquipT.instApplicative = Applicative.mk
@[inline]
def
Lake.EquipT.bind
{ρ : Type u}
{m : Type v → Type w}
[Bind m]
{α β : Type v}
(self : Lake.EquipT ρ m α)
(f : α → Lake.EquipT ρ m β)
:
Lake.EquipT ρ m β
Equations
- self.bind f fetch = do let a ← self fetch f a fetch
Instances For
instance
Lake.EquipT.instMonad
{ρ : Type u}
{m : Type v → Type w}
[Monad m]
:
Monad (Lake.EquipT ρ m)
Equations
- Lake.EquipT.instMonad = Monad.mk
instance
Lake.EquipT.instMonadLift
{ρ : Type u}
{m : Type v → Type w}
:
MonadLift m (Lake.EquipT ρ m)
instance
Lake.EquipT.instMonadFunctor
{ρ : Type u}
{m : Type v → Type w}
:
MonadFunctor m (Lake.EquipT ρ m)
Equations
- Lake.EquipT.instMonadFunctor = { monadMap := fun {α : Type ?u.26} (f : {β : Type ?u.26} → m β → m β) (x : Lake.EquipT ρ m α) (ctx : ρ) => f (x ctx) }
@[inline]
def
Lake.EquipT.failure
{ρ : Type u}
{m : Type v → Type w}
[Alternative m]
{α : Type v}
:
Lake.EquipT ρ m α
Equations
- Lake.EquipT.failure x = failure
Instances For
@[inline]
def
Lake.EquipT.orElse
{ρ : Type u}
{m : Type v → Type w}
[Alternative m]
{α : Type v}
:
Lake.EquipT ρ m α → (Unit → Lake.EquipT ρ m α) → Lake.EquipT ρ m α
Equations
- Lake.EquipT.orElse = Lake.EquipT.compose Alternative.orElse
Instances For
instance
Lake.EquipT.instAlternative
{ρ : Type u}
{m : Type v → Type w}
[Alternative m]
:
Alternative (Lake.EquipT ρ m)
Equations
- Lake.EquipT.instAlternative = Alternative.mk (fun {α : Type ?u.27} => Lake.EquipT.failure) fun {α : Type ?u.27} => Lake.EquipT.orElse
@[inline]
def
Lake.EquipT.throw
{ρ : Type u}
{m : Type v → Type w}
{ε : Type v}
[MonadExceptOf ε m]
{α : Type v}
(e : ε)
:
Lake.EquipT ρ m α
Equations
- Lake.EquipT.throw e x = throw e
Instances For
@[inline]
def
Lake.EquipT.tryCatch
{ρ : Type u}
{m : Type v → Type w}
{ε : Type v}
[MonadExceptOf ε m]
{α : Type v}
(self : Lake.EquipT ρ m α)
(c : ε → Lake.EquipT ρ m α)
:
Lake.EquipT ρ m α
Equations
- self.tryCatch c f = tryCatchThe ε (self f) fun (e : ε) => c e f
Instances For
instance
Lake.EquipT.instMonadExceptOf
{ρ : Type u}
{m : Type v → Type w}
(ε : Type v)
[MonadExceptOf ε m]
:
MonadExceptOf ε (Lake.EquipT ρ m)
Equations
- Lake.EquipT.instMonadExceptOf ε = { throw := fun {α : Type ?u.32} => Lake.EquipT.throw, tryCatch := fun {α : Type ?u.32} => Lake.EquipT.tryCatch }
@[always_inline]
instance
Lake.EquipT.instMonadFinallyOfMonad
{ρ : Type u}
{m : Type v → Type w}
[MonadFinally m]
[Monad m]
:
MonadFinally (Lake.EquipT ρ m)
Equations
- One or more equations did not get rendered due to their size.