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

kahl at cas.mcmaster.ca kahl at cas.mcmaster.ca
Tue Jan 6 12:15:46 EST 2009


Twan van Laarhoven <twanvl at gmail.com> replied:

 > kahl at cas.mcmaster.ca wrote:
 > > Me neither...
 > > 
 > > How about:
 > > 
 > > -- intended for |qualified| import |as Ord|:
 > > newtype Dual a = Dual { unDual :: a } deriving Eq
 > 
[...]
 >
 >   - "dual" can mean many more things.

Exactly --- that's why I propose qualified import,
so one would use, e.g.:

   sort . map Ord.Dual

clarifying that one is using the dual Ord instance.
(Ordering duality is about the fact that
 the converse of an ordering relation is an ordering relation again;
 the Haskell type class |Ord| is the special case of linear orderings.
)

This is standard terminology,
and I think we should encourage
such use of standard terminology and concepts.

Of course, alternatives remain available,
in the spirit of Henning Thielemann's ``Warm, fuzzy thing Transformer'': 

> It was argued that people avoid Haskell because of terms from Category
> theory like 'Monad'. This problem can now be solved by a wrapper which
> presents all the WWW without monads! Start e.g. at
>  
> http://saxophone.jpberlin.de/MonadTransformer?source=http%3A%2F%2Fwww%2Ehaskell%2Eorg%2Fhaskellwiki%2FCategory%3AMonad&language=English

;-)


Wolfram


More information about the Libraries mailing list