On 18/03/13 19:07, s9gf4ult wrote:

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


Whilst it's true that IO cannot be performed within an STM action, a common pattern is to return the necessary IO action from the STM action, and then run it once the STM transaction has completed successfully.

Tim