[Haskell-cafe] Re: (flawed?) benchmark : sort
gtener at gmail.com
Mon Mar 10 15:31:37 EDT 2008
It certainly makes perfect sense, because total order antisymmetry law
IF a <= b AND b <= a THEN a = b
However it should rather be written
IF a <= b AND b <= a THEN a ~= b,
since = could be any equivalence class. However, we can also specify the Ord
type Foo = Foo Int (Int->Int)
in this way:
instance Ord Foo where
compare (Foo a _) (Foo b _) = compare a b
which yields equivalence relation that is not assuming equivalence of the
So this restriction does not seem to work on Adrian Hey's side.
On Mon, Mar 10, 2008 at 8:06 PM, Dan Weston <westondan at imageworks.com>
> On the other hand, though the behavior of == is not defined by the
> Report, it does require in 6.3.1 that if compare is defined, then ==
> must be defined. That strongly implies a semantic causal link (in the
> Free Theorem kind of way), that the semantics of Ord completely specify
> the semantics of Eq, and the only free and continuous way to specify
> this is to make == and EQ always agree.
> I would (almost) take this conclusion as normative as well.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe