From 070d034de9695f9022567c4d70bcaa6e0a08ccd1 Mon Sep 17 00:00:00 2001 From: Michael Walker Date: Fri, 19 Dec 2014 06:24:50 +0000 Subject: [PATCH] Implement IO's 'spawn' in terms of other conc primitives --- Control/Monad/Conc/Class.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Control/Monad/Conc/Class.hs b/Control/Monad/Conc/Class.hs index a412a1c..7f5b85f 100755 --- a/Control/Monad/Conc/Class.hs +++ b/Control/Monad/Conc/Class.hs @@ -35,9 +35,9 @@ class Monad m => ConcFuture future m | m -> future where instance ConcFuture MVar IO where spawn ma = do - mvar <- newEmptyMVar - void . forkIO $ ma >>= putMVar mvar - return mvar + cvar <- new + fork $ ma >>= put cvar + return cvar get = readMVar