[Haskell-cafe] STM orElse semantics

Tom Davies tgdavies at gmail.com
Wed Mar 25 07:21:20 EDT 2009

I'm not 100% clear on the behaviour of the STM function orElse. The
documentation says:

"Compose two alternative STM actions (GHC only). If the first action
completes without retrying then it forms the result of the orElse.
Otherwise, if the first action retries, then the second action is
tried in its place. If both actions retry then the orElse as a whole

What is the definition of retrying in "If the first action completes
without retrying then..." -- does it mean only explicitly retrying via
the retry function, or does it include a retry caused by a write
conflict at commit time of the first action?

That is, if the first action could complete, but doesn't simply due to  
interference from another transaction, does orElse run the second  
action, or rerun the first?

More information about the Haskell-Cafe mailing list