State monad transformer (source code)

= State monad transformer
{title2=$\operatorname{StateT}\ S\ M\ A=S\to M(A,S)$}

A <state monad> layered over a base <computational monad>. An unsuccessful base computation may return no final <program state>; this matters when combining it with an <exception monad transformer>.