Data.Map, Data.IntMap documentation

Aaron Denney wnoise at
Sat Aug 18 23:40:40 EDT 2007

On 2007-08-18, Adrian Hey <ahey at> wrote:
> Arie Peterson wrote:
>> 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.
> True, but in practice it's hard to think of any Ordering that isn't
> completely arbitrary, other than reals perhaps.

No?  These are usually somewhat arbitrary, but not completely arbitrary.

> It isn't obvious to me that 'A' is less than 'B', or (1,2) is less than (2,1).

Both depend on convention.  For pairs, either convention make sense, so
we pick one arbitrarily.  For something like complex numbers, there are
many things one could do, but none of them make sense, essentially
because of the /topology/.

There are degrees of arbitrariness.  We can work with small amounts just
fine.  Large amounts are more troublesome.

Aaron Denney

More information about the Libraries mailing list