I'm sure others will want to chime in here, but I'll offer my two cents.

On Sun, 11 Mar 2012 22:38:56 -0500, E R <pc88m...@gmail.com> wrote:
snip
> 
> So, again, what is the Haskell philosophy towards using mutable data
> structures in pure functions? Is it:
> 
> 1. leave it to the compiler to find these kinds of opportunities
> 2. just use the immutable data structures - after all they are just as
> good (at least asymptotically)
> 3. you don't want to use mutable data structures because of _____
> 4. it does happen, and some examples are ______
> 
You will find that a surprising amount of the time this will be
sufficient. After all, programmer time is frequently more expensive than
processor time.

That being said, there are some cases where you really do want to be
able to utilize a mutable data structure inside of an otherwise pure
algorithm. This is precisely the use of the ST monad. ST serves to allow
the use of mutable state inside of a function while hiding the fact from
the outside world.

Cheers,

- Ben


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to