<div dir="ltr">Hi Johannes,<div><br></div><div><a href="https://ghc.haskell.org/trac/ghc/ticket/15078">https://ghc.haskell.org/trac/ghc/ticket/15078</a> might be interesting to you.<br></div><div><br></div><div>Cheers,</div><div>Simon</div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-05-28 16:47 GMT+02:00 Johannes Waldmann <span dir="ltr"><<a href="mailto:johannes.waldmann@htwk-leipzig.de" target="_blank">johannes.waldmann@htwk-leipzig.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Cafe,<br>
<br>
I am somewhat surprised that the Haskell Standard (*)<br>
<a href="https://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1270006.3" rel="noreferrer" target="_blank">https://www.haskell.org/<wbr>onlinereport/haskell2010/<wbr>haskellch6.html#x13-1270006.3</a><br>
does not contain any<br>
notation for (intended) properties of Eq and Ord instances,<br>
and their relation. For Java (standard library),<br>
the API spec uses wording like "consistent with equals"<br>
<a href="https://docs.oracle.com/javase/10/docs/api/java/lang/Comparable.html" rel="noreferrer" target="_blank">https://docs.oracle.com/<wbr>javase/10/docs/api/java/lang/<wbr>Comparable.html</a><br>
<br>
I am well aware that semantics (transitivity, etc.)<br>
cannot be enforced statically, in either language.<br>
But both standards still speak of "total order".<br>
Do we (Haskell) need something similar to "consistent with equals"?<br>
<br>
It depends. E.g., looking at a (random) source in containers<br>
(Data.Map.Internal), it seems that it will always use the result of<br>
compare, never of (==), on keys. That's not obvious from the docs.<br>
I just checked -- I can make a type where (==) = undefined,<br>
but write a proper Ord instance, and use it as key type.<br>
<br>
I am asking this because I will be teaching type classes,<br>
with Eq and Ord as examples. I detected the funny situation<br>
that the Java specification looks "more mathematical"<br>
than the corresponding Haskell one. What will the students think ...<br>
<br>
- J.W.<br>
<br>
(*) The Haskell standard is what you find when you scroll<br>
down, down, down to the very bottom of<br>
<a href="https://www.haskell.org/documentation" rel="noreferrer" target="_blank">https://www.haskell.org/<wbr>documentation</a> . So, probably not that important...<br>
______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div><br></div>