Proposal #2560 again: add newtype Down/ReverseOrd to Data.Ord

Twan van Laarhoven twanvl at
Tue Jan 6 06:06:17 EST 2009

Hello list,

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 never followed up to that post, so I am doing that now. Since the discussion
period has ended, let me summarize of responses:

   1. Everyone is in favor of adding it

   2. There is some criticism of the name

   3. Some people (apfelmus) didn't like the getReverseOrd function

As an alternative name, Isaac suggested "Reverse", "ReverseOrd" or "Opposite".

I don't really like the name "Reverse", because that can mean many things:
reversing a list, reverse order of composition, inverse/reverse a relation, etc.
Although it is a bit verbose, "ReverseOrd" is the most clear.

Concerning the "get" function: there is lots precedence in
  - Monoid wrappers (Sum, Product, Endo, etc.)
  - Applicative wrappers (ZipList, Const, etc.)
  - mtl types (State, Reader, etc.),

To resolve the naming bikeshed issue, and because it has been a long time since
the discussion ended, I propose an additional discussion period of 1 week,
ending January 13.


More information about the Libraries mailing list