Proposed addition to stm: atomicallyIO and afterCommit

Twan van Laarhoven twanvl at
Thu Feb 25 18:00:02 EST 2010

Simon Marlow wrote:
> atomicallyIO :: STM (IO a) -> IO a
> atomicallyIO ioSTM = join $ atomically ioSTM
> afterCommit :: IO a -> STM (IO a)
> afterCommit mIO = return mIO

The name "afterCommit" might be confusing. To me it suggests that the argument 
is added to some kind of list to be run at the end of the transaction. For example:

     atomicallyIO $ do
         .. STM ..
         afterCommit $ print 1
         .. STM ..
         afterCommit $ print 2

This does would only print 2, because the return value of the first afterCommit 
is ignored.


More information about the Libraries mailing list