David Anderson wrote: > Dear Haskellers, > > I'm happy, and only slightly intimidated, to announce the initial > release of forkable-monad. > > The short version is that forkable-monad exports a replacement forkIO > that lets you do this: > > type MyMonad = ReaderT Config (StateT Ctx IO) > > startThread :: MyMonad ThreadId > startThread = forkIO threadMain > > threadMain :: MyMonad () > threadMain = forever $ liftIO $ putStrLn "Painless monad stack forking!" > > Note the lack of monad stack deconstruction and reconstruction to > transport it over to the new thread. You'll find the details in the > Haddock documentation for the module.
Nice work! It appears to me that this is subsumed by the recent MonadMorphIO proposal that Anders Kaseorg came up with, though? http://article.gmane.org/gmane.comp.lang.haskell.libraries/12902 fork :: MonadMorphIO m => m () -> m () fork m = morphIO $ \down -> forkIO (down m >> return ()) >> down (return ()) Regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe