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
<http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/Control-Concurrent-MVar.html#t:MVar>
a -> (a -> IO
<http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/System-IO.html#t:IO>
(a, b)) -> IO
<http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/System-IO.html#t: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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe