darcs patch: Add equating p x y = p x == p y
Samuel Bronson
naesten at gmail.com
Thu Oct 19 19:01:06 EDT 2006
On 10/11/06, Nils Anders Danielsson <nad at cs.chalmers.se> wrote:
> Instead of adding 'comparing', 'equating' etc., I suggest that you add
> the more general 'on', which is just as easy to use. ('on' has been
> mentioned on the lists a couple of times before.)
>
> (*) `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?
More information about the Libraries
mailing list