
On Wednesday 04 Jan 2006 5:37 pm, Christian Maeder wrote:
Arie Peterson wrote:
It seems that there are two uses of Set e:
1) the Ord-comparison of e's is a total ordering / Eq e implements semantic equality;
2) Eq e is some equivalence relation, such as in Christian's example above.
This is more often the case than one might like. Even for the type Set itself Eq/Ord can be observed differently by the debugging function showTree.
Well here's my take on this. If we have a module that exports a type (that is an instance of Eq/Ord) and associated functions then either.. The type is a concrete data type, in which case we pretty much have to go for structural equality. or.. The type is an abstract type, in which case we are free to use a more relaxed but semantically useful definition of "equality". But we can't do this AND have the API contain functions which allow users to discriminate between "equal" values. This is just broken (IMO). Regards -- Adrian Hey