Hi > But antisymmetry means that (x <= y) && (y <= x) ==> x = y, where '=' means > identity. Now what does (should) 'identity' mean?
I think you are using the word identity when the right would would be equality. Hence, the answer is, without a doubt, (==). If you define equality, then you are defining equality. > In short, I would consider code where for some x, y and a function f we have > (x <= y) && (y <= x) [or, equivalently, compare x y == EQ] but f x /= f y > broken indeed. I would consider it slightly bad code too. But not broken code. I think Ord functions can assume that Ord is a total ordering, nothing more. Nothing to do with the existence (or otherwise) of entirely unrelated code. Consider the following implementation of Data.Set, which *does* meet all the invariants in Data.Set: data Set a = Set [a] insert x (Set xs) = Set $ x : filter (/= x) xs elems (Set xs) = xs i.e. there is real code in the base libraries which breaks this notion of respecting classes etc. Is the interface to Data.Set broken? I would say it isn't. Thanks Neil _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
