Proposal #2560 again: add newtype Down/ReverseOrd to Data.Ord
Twan van Laarhoven
twanvl at gmail.com
Tue Jan 6 10:58:50 EST 2009
kahl at cas.mcmaster.ca wrote:
> Me neither...
>
> How about:
>
> -- intended for |qualified| import |as Ord|:
> newtype Dual a = Dual { unDual :: a } deriving Eq
In my opinion "dual" is even worse:
- "dual" is not a name that people think about when they want something sorted
in descending order or they want a different priority queue, etc. I think of
names like "reverse", "descending" and "something to do with order".
- "dual" can mean many more things. First of all there are different dualities
in mathematics, I guess this refers to the categorical dual. Then there are many
ways to use that duality in Haskell. The first thing that comes to mind, and
which is a closer fit, is newtype Op t a b = Op (t b a), the dual of a
Control.Category style category.
Twan
More information about the Libraries
mailing list