The State monad gives functionality of both the Reader monad and Writer monad in one. When using the State monad you’re able to read the state at any time and then set it back again, providing read/write access.
Key Points
The function get is used to read the current state
The function put is used to set the state
runState is used to manage execution of functions that run in the State monad
Operations in the State monad can use >>= to be chained together
Functions in the State monad are decorated with State s v. Where s is the type of the state and v is the return type from the function<