The State monad transformer using CPS style.
instance
StateCpsT.instLawfulMonad
{σ : Type u_1}
{m : Type u_1 → Type u_2}
:
LawfulMonad (StateCpsT σ m)
Equations
- ⋯ = ⋯
@[always_inline]
instance
StateCpsT.instMonadStateOf
{σ : Type u_1}
{m : Type u_1 → Type u_2}
:
MonadStateOf σ (StateCpsT σ m)
Equations
- One or more equations did not get rendered due to their size.
@[inline]
def
StateCpsT.lift
{m : Type u_1 → Type u_2}
{α : Type u_1}
{σ : Type u_1}
[Monad m]
(x : m α)
:
StateCpsT σ m α
Equations
- StateCpsT.lift x✝ x s k = do let x ← x✝ k x s
Instances For
@[simp]
theorem
StateCpsT.runK_set
{σ : Type u}
{β : Type u}
{m : Type u → Type v}
(s : σ)
(s' : σ)
(k : PUnit → σ → m β)
:
(set s').runK s k = k PUnit.unit s'
@[simp]
theorem
StateCpsT.runK_modify
{σ : Type u}
{β : Type u}
{m : Type u → Type v}
(f : σ → σ)
(s : σ)
(k : PUnit → σ → m β)
:
(modify f).runK s k = k PUnit.unit (f s)
@[simp]
theorem
StateCpsT.runK_lift
{m : Type u → Type u_1}
{β : Type u}
{α : Type u}
{σ : Type u}
[Monad m]
(x : m α)
(s : σ)
(k : α → σ → m β)
:
(StateCpsT.lift x).runK s k = do
let x ← x
k x s