[Haskell-cafe] STM atomic blocks in IO functions

Rob Stewart robstewart57 at googlemail.com
Fri Jan 13 19:04:51 CET 2012


My question is regarding the correct us of STM in Haskell. I have put
to together a simple example, which represents more verbose code in a
library that I am writing.

The question is a simple one. Must all operations on a TVar happen
within *the same* atomically block, or am I am I guaranteed thread
safety if, say, I have a number of atomically blocks in an IO
function. Here's my example: http://pastebin.com/Hit5vKmk .

Is this example permissible?


Rob Stewart

More information about the Haskell-Cafe mailing list