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.
forkable-monad is available:
* On hackage: http://hackage.haskell.org/package/forkable-monad
* Via cabal: cabal install forkable-monad
* Source and issue tracker: http://code.google.com/p/forkable-monad/
Feedback is of course welcome. As this is my first published Haskell
code and Hackage upload, I expect there will be quite a bit!
- Dave