A monad transformer version of the ST monad.
Warning! This monad transformer should not be used with monads that
can contain multiple answers, like the list monad. The reason is that
the state token will be duplicated across the different answers and
this causes Bad Things to happen (such as loss of referential
transparency). Safe monads include the monads State
, Reader
, Writer
,
Maybe
and combinations of their corresponding monad transformers.