Robert Dockins writes: > On Thursday 06 April 2006 06:44 pm, John Meacham wrote: > > On Thu, Apr 06, 2006 at 10:52:52PM +0100, Brian Hulley wrote: > > [snip a question about Eq and Ord classes] > > > well, there are a few reasons you would want to use inheritance in > > haskell, some good, some bad. > > > > 1. one really does logically derive from the other, Eq and Ord are > > like this, the rules of Eq says it must be an equivalance relation > > and that Ord defines a total order over that equivalance relation. > > this is a good thing, as it lets you write code that depends on > > these properties. > > <PUBLIC SERVICE ANNOUNCEMENT> > > Many of you probably know this already, but for those who might not > know: > > Prelude> let x = read "NaN" :: Float > Prelude> x == x > False > Prelude> x == 0 > False > Prelude> 0 < x > False > Prelude> x < 0 > False > > Ewwwwww! Be careful how far you depend on properties of typeclasses, > and make sure you document it when you do.
It's worse than that. Prelude> let x = read "NaN" :: Float Prelude> compare x x GT Prelude> x > x False So far as I can tell, report does not actualy *require* that |x > y| iff |compare x y == GT|, but this is an unfortunate inconsistency. -- David Menendez <[EMAIL PROTECTED]> | "In this house, we obey the laws <http://www.eyrie.org/~zednenem> | of thermodynamics!" _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe