
18 Mar
2013
18 Mar
'13
5:15 a.m.
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-Co... a -> (a -> IO http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/System-IO.... (a, b)) -> IO http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/System-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