- StatefulExtensions
- Stateful
- put <M, S> (S value)
- modify <M, S> (Func<S, S> modify)
- modifyM <M, S> (Func<S, K<M, S>> modify)
- get <M, S> ()
- gets <M, S, A> (Func<S, A> f)
- getsM <M, S, A> (Func<S, K<M, A>> f)
- state <M, S, A> (Func<S, (A Value, S State)> f)
- bracket <M, S, A> (K<M, Unit> stateSetter, K<M, A> operation)
- Stateful <in M, S>
class StatefulExtensions Source #
method K<M, A> Bracket <M, S, A> (this K<M, Unit> stateSetter, K<M, A> operation) Source #
where
M : Stateful<M, S>, Monad<M>
Runs the stateSetter
to update the state-monad's inner state. Then runs the
operation
. And finally, resets the state to how it was before running stateSetter
.
returns | The result of |
method K<M, Unit> modifyM <M, S> (Func<S, K<M, S>> modify) Source #
where
M : Stateful<M, S>, Monad<M>
method K<M, A> state <M, S, A> (Func<S, (A Value, S State)> f) Source #
where
M : Stateful<M, S>, Monad<M>
method K<M, A> bracket <M, S, A> (K<M, Unit> stateSetter, K<M, A> operation) Source #
where
M : Stateful<M, S>, Monad<M>
Runs the stateSetter
to update the state-monad's inner state. Then runs the
operation
. And finally, resets the state to how it was before running stateSetter
.
returns | The result of |