Proposal #2659: Add sortOn and friends to Data.List

apfelmus apfelmus at
Thu Oct 9 06:13:16 EDT 2008

Duncan Coutts wrote:
>> +1 concerning Down,
>> but I don't like the name. In particular I don't like the "get" prefix
>> in "getDown". I'd simply use
> Can't we do it with just some compare flip function:
> sortBy (thing compare)
> or
> sortBy (thing $ comparing fieldFoo)
> Would that work and what would be a good name?

thing = flip  works :)

But  Down  could be useful on its own, for instance for converting
a heap that stores elements in maximum order into one that stores them
in minimum order, i.e. when there is an Ord class constraint instead of
a simple higher-order function. Some exploration of the design space here

Hm, I think that the  Cache b a  thing is more general, though, it may
be worth extending this to a full proposal.


More information about the Libraries mailing list