
On Nov 30, 2007 2:39 PM, Andrew Coppin
Sebastian Sylvan wrote:
On Nov 29, 2007 9:10 PM, Andrew Coppin
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. -Brent