> Thanks for the tip, although it seems tricky to get it right. I wonder > why there is no strict version of atomicModifyIORef? > Dually there might be a strict version of IORef datatype.
Alternatively, you could use STM, where you can write your own atomic update function, which has the strictness you need (untested): import Control.Concurrent.STM strictUpdate :: (a->a) -> TVar a -> STM () strictUpdate f v = do x <- readTVar v let x1 = f x x1 `seq` writeTVar v x1 g :: (Int->Int) -> TVar Int -> IO () g f v = atomically (strictUpdate f v) Tim _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe