If you talk to anyone who uses floating point numbers for real they would find (0/0)==(0/0) perfectly natural. It disobeys some axioms that Eq instances don't fulfill anyway, but changing it would make a lot of people surprised too. In general, the floating point instances break almost all axioms that you might think exist for numbers.
-- Lennart On Jan 11, 2008 1:27 AM, Wolfgang Jeltsch <[EMAIL PROTECTED]> wrote: > Am Freitag, 11. Januar 2008 08:11 schrieb Lennart Augustsson: > > Some people seem to think that == is an equality predicate. > > This is a big source of confusion for them; until they realize that == > is > > just another function returning Bool they will make claims like > > [1..]==[1..] having an unnatural result. > > > > The == function is only vaguely related to the equality predicate in > that > > it is meant to be a computable approximation of semantic equality (but > > since it's overloaded it can be anything, of course). > > > > -- Lennart > > But class methods are expected to fulfill some axioms. I'd suppose that > (==) > should be an equivalence relation. Of course, this is not implementable > because of infininte data structures. But one could relax the axioms such > that it's allowed for (==) to return _|_ instead of the expected value. > Differentiating between data and codata would of course be the better > solution. > > However, the fact that (0 / 0) == (0 / 0) yields False is quite shocking. > It > doesn't adhere to any meaningful axiom set for Eq. So I think that this > behavior should be changed. Think of a set implementation which uses (==) > to > compare set elements for equality. The NaN behavior would break this > implementation since it would allow for sets which contain NaN multiple > times. > > Best wishes, > Wolfgang > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe >
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe