
19 Sep
2012
19 Sep
'12
2:35 p.m.
On Wed, Sep 19, 2012 at 8:00 PM,
So how do I force IO actions whose results are discarded (including IO ()) to be strict?
In your particular case it looks like you want Data.IORef.modifyIORef'. If your version of GHC doesn't include it you can write it like so: -- |Strict version of 'modifyIORef' modifyIORef' :: IORef a -> (a -> a) -> IO () modifyIORef' ref f = do x <- readIORef ref let x' = f x x' `seq` writeIORef ref x' -- Johan