[Haskell-cafe] Re: (flawed?) benchmark : sort

ajb at spamcop.net ajb at spamcop.net
Thu Mar 13 20:29:06 EDT 2008

G'day all.

Quoting Adrian Hey <ahey at iee.org>:

> If that's supposed it imply you think I'm in a minority of one I
> don't think you've been following this thread very well.

Sorry, that was a bit of hyperbole.

> Even the report uses the word "equality" in the prose.

Indeed, and the only sensible meaning of "equality" that I can
think of is _semantic_ equality.  Two values are semantically equal
if they mean the same thing.

A concrete example of a quotient type that I had in mind is rationals.
A rational is implemented as, for the sake of argument, a pair of
integers.  Two rational numbers, a/b and c/d, are equal iff ad = bc.
That's what everyone means by equality for rationals.

It's true that rationals have a normal form, and this can be
enforced by a smart constructor and an unbreakable abstraction.  But
if you've got an unbreakable abstraction, then you've also got the
mechanism to enforce observational equality.

Moreover, not all quotient types have a "one true" normal form (e.g.
regular expressions), and even in cases where there is a sensible
normal form, it might be undesirable for reasons of performance or

> Besides there are good pragmatic safety and performance reasons
> why Haskell should provide at least one class that offers
> strong guarantees regarding equality and the (==) operator.

Well, I haven't heard any reasons that have convinced me yet.  No
arguing over taste, of course.

> ..and has almost certainly been implicitly assumed by heaven knows
> what extant code (some of it in the standard libraries I suspect).

Nobody has yet gone to the trouble of consulting either heaven or the
source code (in whatever order is deemed appropriate) to see if this
claim is true.

Andrew Bromage

More information about the Haskell-Cafe mailing list