Proposed addition to stm: atomicallyIO and afterCommit

Ben Franksen ben.franksen at online.de
Thu Feb 25 13:59:12 EST 2010


>    do
>      ... IO code ...
>      v <- atomicallyIO $ do
>          ... STM code ...
>          if .....
>              then do
>                  ... STM code ...
>                  afterCommit $ ... IO actions ...
>              else do
>                  ... STM code ...
>                  afterCommit $ ... IO actions ...

Interesting idea, reminds me of the wrap combinator of cml
(http://hackage.haskell.org/packages/archive/cml/0.1.3/doc/html/Control-Concurrent-CML.html#v%3Awrap).

Simon Marlow wrote:
> Personally I'm in two minds about this. It certainly captures a useful
> idiom, but it fails the "don't name compositions" test, and one of the
> additions is just a renaming of 'return', which makes it hard to justify.

I'd say resolve this and similar proposals in a generic way: add it to a
separate module on top of (name-space-hierarchically speaking)
Control.Concurrent.STM, e.g. Control.Concurrent.STM.Util, whatever.

Cheers
Ben



More information about the Libraries mailing list