What are the laws for Eq1, Eq2, Ord1, and Ord2?

Gershom B gershomb at gmail.com
Fri Mar 16 03:55:39 UTC 2018


On March 15, 2018 at 11:50:45 PM, David Feuer (david.feuer at gmail.com) wrote:

For Map and HashMap, yes, Eq2 and Ord2 are the problem. For Set and
HashSet, Eq1 and Ord1 are trouble.

The advantage of the flexibility is that for a Functor or Bifunctor you get
an optimization: instead of mapping a function or two over each container
to give them the same type and then comparing the results, you can fuse it
all into one operation. Of course, the same thing could also be done for
each type using rewrite rules, but that's kind of gross.

Right. But it is the possibility of this optimization that breaks things.
In particular, `Set` is not a functor (and does not permit mapping over
it), but it _should_ be able to be an instance of Eq1.

-g
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20180315/6bacd75c/attachment-0001.html>


More information about the Libraries mailing list