[Haskell-cafe] A question about State Monad and Monad in general
wren ng thornton
wren at freegeek.org
Fri Jul 16 00:17:36 EDT 2010
C K Kashyap wrote:
> Thanks Daniel,
> Better refactorability.
>> If you're using monadic style, changing from, say,
>> State Thing
>> StateT Thing OtherMonad
>> or from
>> StateT Thing FirstMonad
>> 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
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. However, the improvements themselves
are coming from the different representation; the use of monadic
notation just allows you to switch the representation without altering
More information about the Haskell-Cafe