once we have ordNub, we can create lots of RULES like the following
{-# RULES "nub/ordNub" nub = ordNub :: [String] -> [String] #-}
{-# RULES "nub/ordNub" nub = ordNub :: [Int] -> [Int] #-}
{-# RULES "nub/ordNub" nub = ordNub :: [Integer] -> [Integer] #-}
actually, we probably want one that uses IntMap for ints. it is
signifigantly faster.
I don't suppose there is a way to match a RULE to a class constraint? I
don't see how it would be implemented in any easy way since classes get
desugared away pretty early... but it would be an interesting feature..
{-# RULES "nub/ordNub" forall (a::*) . Ord a => nub = ordNub :: [a] -> [a] #-}
or something...
{-# RULES "nub/ordNub" forall (x::Ord a => a). nub x = ordNub x #-}