
Twan van Laarhoven
About two and a half months ago I proposed that the following newtype (under the name "Down") be added to Data.Ord:
newtype ReverseOrd a = ReverseOrd { getReverseOrd :: a }
instance Ord ReverseOrd where a <= b = getReverseOrd b <= getReverseOrd a -- other methods, etc.
[...]
I don't really like the name "Reverse",
Me neither... How about: -- intended for |qualified| import |as Ord|: newtype Dual a = Dual { unDual :: a } deriving Eq instance Ord a => Ord (Dual a) where Dual x <= Dual y = y <= x Dual x < Dual y = y < x Dual x >= Dual y = y >= x Dual x > Dual y = y > x Dual x `compare` Dual y = y `compare` x Dual x `min` Dual y = y `max` x Dual x `max` Dual y = y `min` x Wolfram