18.03.2013 13:26, Alexander V Vershilov пишет:

I can not use atomicModifyIORef because it works with pure computation

atomicModifyIORef :: IORef a -> (a -> (a, b)) -> IO b

nor STM, becuase IO is not acceptable inside STM transaction.

I just need some thread-safe blocking variable like MVar

modifyMVar :: MVar a -> (a -> IO (a, b)) -> IO b