Subject: Re: unsafeInterleaveIO ordering

Robert Ennals rje33@cam.ac.uk
Sat, 30 Aug 2003 18:48:15 +0100 (BST)


[resending this mail from a different address as it didn't seem to get
through the first time. I apologise if you see multiple copies.]

[snip]

> If you're using an eager haskell implementation which does some
> speculative evaluation of things that look cheap and that you might want
> to evaluate, the answer is probably no.  (Because, having decided to do
> some speculative work in the absence of a demand, it might decide it has
> done enough work after the first action, and then later it would finish
> the job when the result is actually demanded.)

Actually speculative/optimistic evaluation should be fine.

Optimistic Evaluation refuses to speculate IO for exactly this reason.
If a speculative computation attempts to call unsafePerformIO or evaluate
the IO from an unsafeInterleaveIO then the speculation is immediately aborted.
IO is never speculated.

Anyone wanting to find out more about optimistic evaluation is encouraged
to download the ICFP'03 paper from here:

http://www.cl.cam.ac.uk/users/rje33/publications.html



Threads are still an issue, but that can be dealt with using locking.


-Rob