darcs patch: Add equating p x y = p x == p y

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Fri Oct 20 06:34:15 EDT 2006


"Samuel Bronson" <naesten at gmail.com> wrote:

> >   (*) `on` f = \x y -> f x * f y
> >
> >   groupBy ((==) `on` fst)
> >   sortBy (compare `on` snd)
> >   maximumBy (customCompare `on` f)
> 
> Oh, oops. I meant to send this to the list the *first* time... so, um,
> where is the patch for this?

The question is where in the module hierarchy should such a function
live?  It does not really belong with Data.List, or indeed any
particular data structure module.

I would like to propose a new module for functions like this, which are
in some sense "purely" functional, that is, they do not involve any data
structure at all, just functions.  Other examples would be

    const
    id
    flip
    (.)
    ($)
    ($!)

Any suggestions for a good name for such a module?  Data.Function does
not sound right to my ears.

Regards,
    Malcolm


More information about the Libraries mailing list