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 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe