[Haskell-cafe] Re: (flawed?) benchmark : sort
wnoise at ofb.net
Fri Mar 14 17:59:15 EDT 2008
On 2008-03-10, Dan Weston <westondan at imageworks.com> wrote:
> However, the report text is normative:
> 6.3.2 (The Ord Class):
> "The Ord class is used for totally ordered datatypes."
> This *requires* that it be absolutely impossible in valid code to
> distinguish equivalent (in the EQ sense, not the == sense) things via
> the functions of Ord. The intended interpretation of these functions is
> clear and can be taken as normative:
> forall f . (compare x y == EQ and (f x or f y is defined))
> ==> f x == f y)
That depends a great deal on your definitions. Is the (=) in
the set theory structure equality, or is it merely a binary relation
with the appropriate properties?
If we take the result of the compare function being EQ to mean
structural equality, that throws out the possibility of even "safe"
semantic equality, and no interesting data structures can be made
instances of Ord. That's less than useful.
Certainly, for the domain of /just the ordering comparisons/, yes, equal
elements are equal, and cannot be distinguished, but that just means
cannot be distinguished by the provided binary relations.
More information about the Haskell-Cafe