
C K Kashyap wrote:
Thanks Daniel,
Better refactorability.
If you're using monadic style, changing from, say, State Thing to StateT Thing OtherMonad
or from StateT Thing FirstMonad to StateT Thing SecondMonad
typically requires only few changes. Explicit state-passing usually requires more changes.
So, performance gain (runtime/memory) is not a side effect of Monadic style right?
Generally speaking, right: monadic style won't improve performance. However, using monadic notation may allow you to change the backing monad to a different representation of "the same" computation, thereby giving asymptotic improvements[1]. However, the improvements themselves are coming from the different representation; the use of monadic notation just allows you to switch the representation without altering the code. [1] http://www.iai.uni-bonn.de/~jv/mpc08.pdf -- Live well, ~wren