[Haskell-cafe] Re: ANN: forkable-monad 0.1
apfelmus at quantentunnel.de
Wed Apr 21 11:54:06 EDT 2010
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.
It appears to me that this is subsumed by the recent MonadMorphIO
proposal that Anders Kaseorg came up with, though?
fork :: MonadMorphIO m => m () -> m ()
fork m = morphIO $ \down -> forkIO (down m >> return ())
>> down (return ())
More information about the Haskell-Cafe