[Haskell-cafe] A tale of Project Euler

Brent Yorgey byorgey at gmail.com
Fri Nov 30 15:33:17 EST 2007

On Nov 30, 2007 2:39 PM, Andrew Coppin <andrewcoppin at btinternet.com> wrote:

> Sebastian Sylvan wrote:
> > On Nov 29, 2007 9:10 PM, Andrew Coppin <andrewcoppin at btinternet.com>
> wrote:
> >
> >> How do you avoid accidentally recomputing the list multiple times?
> >>
> >
> > What do you mean? It's exactly the same as your original program but
> > with ST instead of IO? Why would it get accidentally recomputed in
> > this scenario and not before?
> >
> Because before the moment when it gets executed relative to the main I/O
> thread is explicitly defined, and now it isn't.

Yes it is.  There's nothing magical about how the I/O thread guarantees
when/in what order things get executed; it all has to do with data
dependencies.  Since the ST monad represents a strict state thread, it will
have exactly the same behavior in terms of when/in what order things get
executed as in the IO monad.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071130/43901b3f/attachment.htm

More information about the Haskell-Cafe mailing list