Data.Map, Data.IntMap documentation

Arie Peterson ariep at xs4all.nl
Fri Aug 17 04:27:06 EDT 2007


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



More information about the Libraries mailing list