
23 Aug
2009
23 Aug
'09
3:21 p.m.
Also, you could define a forkM function like this: forkM :: M () -> M ThreadId forkM (M r) = M $ mapReaderT forkIO r which could be used like this: test = runM "foo" $ do forkM $ loop callback liftIO $ print "here" If we were to expand forkM in test, we would get something like: test' = runM "foo" $ do env <- ask liftIO $ forkIO (runM env $ loop callback) liftIO $ print "here" So, this does not change the 'rule' of forkIO having to come before a runM. It just wraps it up nicely. - jeremy