deepseq: instance NFData (a -> b)

David Feuer david.feuer at gmail.com
Sun May 1 16:06:17 UTC 2016


I say no. An `IORef` is just a pointer, and forcing one to NF means
quite simply that you determine exactly where it points, which is
completely different from forcing whatever happens to be on the other
end. A function seems much more problematic.

On Sun, May 1, 2016 at 11:00 AM, Herbert Valerio Riedel
<hvriedel at gmail.com> wrote:
> On 2016-05-01 at 16:51:45 +0200, Boespflug, Mathieu wrote:
>
> [...]
>
>> This instance doesn't make much sense (to me at least) and is pretty
>> problematic for apps that use NFData constraints as evidence that
>> values are ground and fully evaluated (hence don't capture arbitrary
>> resources). In HaskellR we use NFData constraints to make sure only
>> fully evaluated ground data escapes the scope of a region. But
>> functions are not a first-order values. They can leak arbitrary
>> resources out of the scope of a region.
>
> Are the recently added NFData instances for IORef/MVar problematic as
> well?
>
> -- hvr
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


More information about the Libraries mailing list