state package:adjunctions

Embed a simple state action into the monad.
A generalized State monad, parameterized by a Representable functor. The representation of that functor serves as the state.
A memoized state monad parameterized by a representable functor g, where the representatation of g, Rep g is the state to carry. The return function leaves the state unchanged, while >>= uses the final state of the first computation as the initial state of the second.
A state transformer monad parameterized by:
  • g - A representable functor used to memoize results for a state Rep g
  • 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.
Minimal definition is either both of get and put or just state
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 value, discarding the final state.
Evaluate a state computation with the given initial state and return the final state, discarding the final value.
Evaluate a state computation with the given initial state and return the final state, discarding the final value.
Map both the return value and final state of a computation using the given function.
Unwrap a state monad computation as a function. (The inverse of state.)