deepseq: Add more instances. #50
John Villarreal
j0villarreal at yahoo.com
Wed Jan 15 09:18:35 UTC 2020
That's interesting! I do see Eq instances for types TVars and IORefs but no Ord instance. But I don't see an Eq instance defined for the (->) type which also seems to be considered a reference-like type in the discussion. However I do think the argument can be made that the Eq instance for reference types is equally questionable for similar reasons.
On Wednesday, 15 January 2020, 09:06:52 UTC, Zemyla <zemyla at gmail.com> wrote:
We do have Eq instances for those types, though, and they say that they compare the references rather than the values. Is NFData more like Eq or Show?
On Wed, Jan 15, 2020, 02:59 John Villarreal via Libraries <libraries at haskell.org> wrote:
I too agree that NFData instances for reference types are more trouble than worth the modest convenience they buy us. We don't have Show instances for reference-like types either and I don't think anybody would be arguing for those either.
John
On Wednesday, 15 January 2020, 07:55:40 UTC, Henning Thielemann <lemming at henning-thielemann.de> wrote:
> David put my thoughts pretty clearly: is it more useful or more
> confusing? I am also leaning toward more confusing. Hopefully more can
> weigh in on this.
I also think NFData instances for reference types are more dangerous than
helpful. Since laziness and strictness account for subtle programming
mistakes, it is better if GHC tells you that 'rnf tvar' does possibly not
perform what you expect. I'd even consider to add an instance with a type
error message to show the user that this instance has been omitted by
intention.
_______________________________________________
Libraries mailing list
Libraries at haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________
Libraries mailing list
Libraries at haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20200115/e8fbed8f/attachment.html>
More information about the Libraries
mailing list