The State monad transformer using CPS style.
@[always_inline]
instance
StateCpsT.instMonadStateOf
{σ : Type u}
{m : Type u → Type v}
:
MonadStateOf σ (StateCpsT σ m)
@[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}
{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