The State monad transformer using CPS style.
An alternative implementation of a state monad transformer that internally uses continuation passing style instead of tuples.
Instances For
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
Equations
- One or more equations did not get rendered due to their size.
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.
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.
Equations
- StateCpsT.lift x x✝ s k = do let x ← x k x s
Instances For
Equations
- StateCpsT.instMonadLiftOfMonad = { monadLift := fun {α : Type ?u.2} => StateCpsT.lift }