[stm] strange behavior with TQueue and STM's alternative instance

Bas van Dijk v.dijk.bas at gmail.com
Mon Dec 10 16:07:49 CET 2012

On 10 December 2012 15:20, Simon Marlow <marlowsd at gmail.com> wrote:
> I don't think reading or writing in the inner transaction affects the bug,

If you don't read or write in the inner transaction, like in the
following example, the program correctly prints 2:

import Control.Concurrent.STM
main = do
  x <- atomically $ do
         t <- newTVar 1
         writeTVar t 2
         (retry `orElse` return ()) `orElse` return ()
         readTVar t
  print x

More information about the Libraries mailing list