
17 Aug
2007
17 Aug
'07
4:27 a.m.
Adrian Hey wrote:
The Ord-constraint is too limiting for tries.
Well it isn't going to disappear while I'm in charge of GT class :-) Why do you object to it? Ultimately we must be able to test keys for equality at least. Is there a type that is an instance of Eq, but not Ord (or could not reasonably be made an instance of Ord)?
Complex numbers, and trees, and probably many more. Some types do not have a natural total ordering. Sure, you can pick some arbitrary one, but that can be confusing, and it decreases the ability of the type system to catch semantic errors. I would much prefer to have a separate class for "arbitrary total orderings", with an automatic Ord-based instance. Kind regards, Arie