Add Data.Eq.equating to match Data.Ord.comparing?

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Thu Sep 20 06:54:47 EDT 2007


> >  > pairWise :: (b -> b -> c) -> (a -> b) -> a -> a -> c
> >  > pairWise pair project x y = pair (project x) (project y)
> 
> We call this function "on", and I believe it has been recently added
> to the standard libraries.

In Data.Functions.

 >   x = groupBy (equating snd) pairs
thus becomes
     x = groupBy ((==) `on` snd) pairs

Regards,
    Malcolm


More information about the Libraries mailing list