Re: [Haskell-cafe] Breaking change to Eq accepted by Core Libraries Committee

For what it's worth, one of the examples listed in the issue where (/=) is not simply the negation of (==) is violating the laws. It is the one in https://hackage.haskell.org/package/numbers-3000.2.0.2/docs/Data-Number-Inte... That module defines two intervals to be equal if their bounds are equal, but to be unequal only if they are disjoint. In my eyes this speaks for the proposal, because the library author would have been unable to write the broken instance. (And I did look at the proposal some time ago, whence I feel it was indeed discussed or at least mentioned on this list before.) Olaf

Am So., 14. Nov. 2021 um 20:05 Uhr schrieb Olaf Klinke < olf@aatal-apotheke.de>:
That module defines two intervals to be equal if their bounds are equal, but to be unequal only if they are disjoint.
Well, this is simply a broken implementation. Quick question: Is the Ord instance lawful or not? Hard to tell... (at least without pencil & paper)
In my eyes this speaks for the proposal, because the library author would have been unable to write the broken instance. [...]
But this is an extremely weak argument for the proposal: One can easily write broken instances even with a single (==) method, e.g. violating symmetry etc. As another example: Given some e.g. Monad instance, can one quickly see if it is lawful? I very much doubt so, unless one tries to prove it. Laws of type classes are very much "outside of the Haskell language", anyway, so I see nothing special for Eq.

These arguments and more have already been discussed on the issue page.
https://github.com/haskell/core-libraries-committee/issues/3
Cheers
Melanie Brown
On Sun, Nov 14, 2021 at 14:24, Sven Panne
Am So., 14. Nov. 2021 um 20:05 Uhr schrieb Olaf Klinke
: That module defines two intervals to be equal if their bounds are equal, but to be unequal only if they are disjoint.
Well, this is simply a broken implementation. Quick question: Is the Ord instance lawful or not? Hard to tell... (at least without pencil & paper)
In my eyes this speaks for the proposal, because the library author would have been unable to write the broken instance. [...]
But this is an extremely weak argument for the proposal: One can easily write broken instances even with a single (==) method, e.g. violating symmetry etc. As another example: Given some e.g. Monad instance, can one quickly see if it is lawful? I very much doubt so, unless one tries to prove it. Laws of type classes are very much "outside of the Haskell language", anyway, so I see nothing special for Eq.

Am So., 14. Nov. 2021 um 20:35 Uhr schrieb Melanie Brown via Haskell-Cafe < haskell-cafe@haskell.org>:
These arguments and more have already been discussed on the issue page.
https://github.com/haskell/core-libraries-committee/issues/3
But why on earth has the proposal been accepted then? This is simply a mystery to me...

I didn't understand that either. The original discussion seemed to
have concluded that there was no point to the change aside from
breaking some programs, then suddenly it was proposed and accepted.
I'm confused….
On Sun, Nov 14, 2021 at 2:42 PM Sven Panne
Am So., 14. Nov. 2021 um 20:35 Uhr schrieb Melanie Brown via Haskell-Cafe
: These arguments and more have already been discussed on the issue page.
https://github.com/haskell/core-libraries-committee/issues/3
But why on earth has the proposal been accepted then? This is simply a mystery to me... _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
-- brandon s allbery kf8nh allbery.b@gmail.com

The first post lists plenty of reasonable (IMO) points to why remove `/=`,
so seems like a good proposal.
On Sun, Nov 14, 2021 at 9:48 PM Brandon Allbery
I didn't understand that either. The original discussion seemed to have concluded that there was no point to the change aside from breaking some programs, then suddenly it was proposed and accepted. I'm confused….
On Sun, Nov 14, 2021 at 2:42 PM Sven Panne
wrote: Am So., 14. Nov. 2021 um 20:35 Uhr schrieb Melanie Brown via
Haskell-Cafe
: These arguments and more have already been discussed on the issue page.
https://github.com/haskell/core-libraries-committee/issues/3
But why on earth has the proposal been accepted then? This is simply a mystery to me... _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
-- brandon s allbery kf8nh allbery.b@gmail.com _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
-- Markus Läll

Am 14.11.21 um 20:46 schrieb Brandon Allbery:
I didn't understand that either. The original discussion seemed to have concluded that there was no point to the change aside from breaking some programs, then suddenly it was proposed and accepted. I'm confused….
Same here. Ben -- I would rather have questions that cannot be answered, than answers that cannot be questioned. -- Richard Feynman

On Sun, 2021-11-14 at 20:24 +0100, Sven Panne wrote:
Am So., 14. Nov. 2021 um 20:05 Uhr schrieb Olaf Klinke < olf@aatal-apotheke.de>:
That module defines two intervals to be equal if their bounds are equal, but to be unequal only if they are disjoint.
Well, this is simply a broken implementation. Quick question: Is the Ord instance lawful or not? Hard to tell... (at least without pencil & paper)
No, it's not. All four relations (>), (>=), (<), (<=) are transitive, but (>=) and (<=) should be reflexive, which they aren't: let i = I 0 1 :: Interval Int in i <= i = 1 <= 0 = False Comparability fails as well, which is why the author did not implement `compare`: j = I 0 2 :: Interval Int k = I 1 3 :: Interval Int (j <= k) || (k <= j) = (2 <= 1) || (3 <= 0) = False || False = False Antisymmetry is particularly interesting: It holds, but only for singleton intervals.
In my eyes this speaks for the proposal, because the library author would have been unable to write the broken instance. [...]
But this is an extremely weak argument for the proposal: One can easily write broken instances even with a single (==) method, e.g. violating symmetry etc. As another example: Given some e.g. Monad instance, can one quickly see if it is lawful? I very much doubt so, unless one tries to prove it. Laws of type classes are very much "outside of the Haskell language", anyway, so I see nothing special for Eq.
Indeed in general one can't tell whether a monad instance is lawful (Rice's theorem applies), but a least the class methods aren't trivially redundant. That removes one possible source of non-lawful- ness. Olaf
participants (6)
-
Ben Franksen
-
Brandon Allbery
-
Markus Läll
-
Melanie Brown
-
Olaf Klinke
-
Sven Panne