The State monad transformer using CPS style.
@[inline]
def StateCpsT.run {α σ : Type u} {m : Type u → Type v} [Monad m] (x : StateCpsT σ m α) (s : σ) :
m (α × σ)
Executes an action from a monad with added state in the underlying monad m. Given an initial
state, it returns a value paired with the final state.
While the state is internally represented in continuation passing style, the resulting value is the same as for a non-CPS state monad.
Instances For
@[instance_reducible, always_inline]
instance StateCpsT.instMonadStateOf {σ : Type u} {m : Type u → Type v} :
MonadStateOf σ (StateCpsT σ m)
@[instance_reducible]
For continuation monads, it is not possible to provide a computable MonadAttach instance that
actually adds information about the return value. Therefore, this instance always attaches a proof
of True.
@[inline]
Runs an action from the underlying monad in the monad with state. The state is not modified.
This function is typically implicitly accessed via a MonadLiftT instance as part of automatic
lifting.