State monad (source code)

= State monad
{title2=$S\to(A,S)$}

A computation represented by a <function> from an initial <program state> to a result and a final <program state>. Its sequencing passes each output <program state> to the next computation.