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