
On Mon, Aug 11, 2003 at 12:15:57PM +0100, Simon Marlow wrote:
I'm sure you're right, but I don't understand why an unsafePerformIO has to have its own thread at all.
In Hugs, threads exist only in the IO monad.
It's fine for an unsafePerformIO to run to completion before anything else happens - in fact that's exactly what I'd expect in a single-threaded system.
Sure, but is that what you'd expect of unsafeInterleaveIO?
Certainly! Consider the common use of unsafeInterleaveIO to return the contents of a file lazilly. You would write something like this: getContents = unsafeInterleaveIO f where f = do c <- getChar xs <- unsafeInterleaveIO f return (c:xs) as you can see, it's fine for each invocation of f to run to completion, because it uses nested unsafeInterleaveIO to get the interleaving. Cheers, Simon
participants (1)
-
Simon Marlow