> I am trying to lazily wait an MVar in hugs, in conjunction with
> concurrent haskell:
>
> [code snipped]
>
> I think that main2 should work, because in evaluating the result of
> f2, the main thread should suspend and yield.
Hugs creates a fresh scheduler instance for each invocation of
unsafeP
I am trying to lazily wait an MVar in hugs, in conjunction with
concurrent haskell:
-
import Concurrent
import IOExts
f = do
v <- newEmptyMVar
c <- getContents
forkIO (putMVar v (head c))
r <- unsafeInterleaveIO (takeMVar v)
return v
f2 = f >>= unsafeInterleaveIO . takeM