On 18 November 2011 13:17, Daniel Fischer
<[email protected]> wrote:
> 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

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to