
18 Nov
2011
18 Nov
'11
9:54 a.m.
On 18 November 2011 13:17, Daniel Fischer
On Friday 18 November 2011, 13:05:06, Yves Parès wrote:
...so there is no way to do that inside the function passed to modifySTRef? In other words, there is no way to ensure inside a function that its result will be evaluated strictly?
Well,
modifySTRef ref fun = do val <- readSTRef ref writeSTRef ref (fun val)
But note therefore that you can just: val <- readSTRef ref writeSTRef ref $! fun val rather than using modifySTRef. Duncan