Data.Map, Data.IntMap documentation

Twan van Laarhoven twanvl at
Fri Aug 17 23:04:20 EDT 2007

Stefan O'Rear wrote:

>>>Interesting problem, but I don't see any reason why this could not
>>>be an instance of Ord.
> There's nothing stoping you from writing
> instance Ord TypeRep where compare = comparing show
> STRef could also be cheaply made Ord, ...

What we really need for this is a 'unsafe' PrimOrd class, sugesting that 
the comparison is not intended for human consumption.
 > class Eq a => PrimOrd a where
 >     primcompare :: a -> a -> Ordering
 > class PrimOrd a => Ord a where
 >     -- needs something like class aliasses to be useble

Now the Data.Map functions can be based on PrimOrd, because we don't 
actually care about the ordering. Except for to/fromAscList, which 
should check the ordering is actually an Ord.


More information about the Libraries mailing list