State monads are a kind of monad that carry a state that might change during each computation run in the monad. Implementations are usually of the form State s a which represents a computation that carries and potentially modifies a state of type s and produces a result of type a, but the term &quo...