Commit 167f64dc authored by Nicolas Pouillard's avatar Nicolas Pouillard

Remove inMVar and inMVarIO

parent 2c6f3936
Pipeline #806 canceled with stage
...@@ -303,23 +303,3 @@ fib :: Int -> Int ...@@ -303,23 +303,3 @@ fib :: Int -> Int
fib 0 = 0 fib 0 = 0
fib 1 = 1 fib 1 = 1
fib n = fib (n-1) + fib (n-2) fib n = fib (n-1) + fib (n-2)
-----------------------------------------------------------------------
-- Memory Optimization
inMVarIO :: MonadIO m => m b -> m b
inMVarIO f = do
mVar <- liftIO newEmptyMVar
zVar <- f
_ <- liftIO $ forkIO $ putMVar mVar zVar
liftIO $ takeMVar mVar
inMVar :: b -> IO b
inMVar f = do
mVar <- newEmptyMVar
let zVar = f
_ <- liftIO $ forkIO $ putMVar mVar zVar
liftIO $ takeMVar mVar
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment