Wonderful post!  I just want to throw a minor wrench in:

[EMAIL PROTECTED] wrote:
"Eq" is not merely a function of type a -> a -> Bool.  It's a concept
with semantics.  It must be an equivalence relation, and it also must
mean semantic equality.  Functions that respect semantic equality have
the property that x == y implies f x == f y.

(No, none of these restrictions are in the language report.  But I'd be
annoyed if someone defined a version of Eq that didn't have these
properties.)

From what you argue above, and reading the IEEE 754 standard correctly, instance Eq Float and instance Eq Double should be *removed* !

That is because +0. == -0. is true (according to IEEE 754) but it is legitimate to have functions f where f +0. <> f -0. [this mostly shows up for complex rather than real functions, but this is still in IEEE 754].

The easiest interpretation is that == as defined in IEEE 754 is not in fact a semantic equality predicate. Very messy. But having a good language (Haskell) that does not respect established standards (IEEE 754) when it claims to implement 'floating point' computations is a real drawback.

Jacques
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to