[Haskell-cafe] A question about State Monad and Monad in general
C K Kashyap
ckkashyap at gmail.com
Fri Jul 16 02:35:29 EDT 2010
Thanks Dave ... a quick question though could you point me to an example
where I could build up my own in place modifiable data structure in Haskell
without using any standard library stuff?
For example, if I wanted an image representation such as this
[[(Int,Int.Int)]] - basically a list of lists of 3 tuples (rgb) and wanted
to do in place replacement to set the pixel values, how could I go about it.
On Fri, Jul 16, 2010 at 9:47 AM, wren ng thornton <wren at freegeek.org> wrote:
> 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
> 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 the code.
>  http://www.iai.uni-bonn.de/~jv/mpc08.pdf<http://www.iai.uni-bonn.de/%7Ejv/mpc08.pdf>
> Live well,
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe