Implement atomicModifyIORef for nhc98.
, newIORef
, readIORef
, writeIORef
, newIORef
, readIORef
, writeIORef
where plainModifyIORef r f = do
a <- readIORef r
case f a of (a',b) -> writeIORef r a' >> return b
where plainModifyIORef r f = do
a <- readIORef r
case f a of (a',b) -> writeIORef r a' >> return b
+#elif defined(__NHC__)
+atomicModifyIORef r f =
+ excludeFinalisers $ do
+ a <- readIORef r
+ let (a',b) = f a
+ writeIORef r a'
+ return b