Implement an ST monad.