[Haskell-cafe] Asynchronous exception wormholes kill modularity

Gregory Collins greg at gregorycollins.net
Fri Mar 26 10:43:39 EDT 2010


Matthew Brecknell <matthew at brecknell.net> writes:

> And is confirmed by a simple test (with GHC 6.10.4 on Linux):
>
> import Prelude hiding(catch)
> import Control.Concurrent
> import Control.Exception
>
> main = do
>   chan <- newEmptyMVar
>   done <- newEmptyMVar
>   kill <- block $ forkIO $ do
>     (takeMVar chan >>= putMVar done)
>       `onException` putMVar done "Exception received during takeMVar"
> ...

Should this be "forkIO $ block" instead of "block $ forkIO"?

G
-- 
Gregory Collins <greg at gregorycollins.net>


More information about the Haskell-Cafe mailing list