> It appears that in the presence of mutable state, a lot of the advantages of monads become moot.<p>In the simpler cases where use of monads can be replaced by simple mutable state -- you still lose out on the explicit types of the mutating vs. pure code.<p>For example, STM is possible because mutating effects are typed, and so can be ruled out of STM transactions.<p>And in the more complex monads (e.g: transformer stacks), mutable state is just not good enough. You can compose transformers to build things that mutable state simply cannot express, and you'd have to CPS transform your code and avoid mutable state to express those things.<p>For example, these two monads:<p><pre><code> ListT (ParsecT m)
ParsecT (ListT m)
</code></pre>
Have no corresponding "mutable state" representations.