
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-Concu...). 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