
17 Aug
2007
17 Aug
'07
11:04 p.m.
Stefan O'Rear wrote:
Data.Typeable.TypeRep
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. Twan