StateT package:monadology

A state transformer monad parameterized by:
  • s - The state.
  • m - The inner monad.
The return function leaves the state unchanged, while >>= uses the final state of the first computation as the initial state of the second.
Dangerous, because the MVar won't be released on exception.
Evaluate a state computation with the given initial state and return the final value, discarding the final state.
Evaluate a state computation with the given initial state and return the final state, discarding the final value.
Run the StateT on an MVar, taking the initial state and putting the final state.
Map both the return value and final state of a computation using the given function.
withStateT f m executes action m on a state modified by applying f.