The State Monad
How can we add a state to actions?
Let actions take the state as an argument, and deliver a new state as a result.
newtype State s m a = State (s -> m (s,a))
Parameterised on both
the state and the
underlying monad.
Föregående bild
Nästa bild
Tillbaka till första bilden
Visa grafisk version