
11 Oct
2006
11 Oct
'06
10:46 a.m.
On Wed, 11 Oct 2006, Duncan Coutts
Wed Oct 11 15:14:32 BST 2006 Duncan Coutts
* Add equating p x y = p x == p y Just as useful as the 'comparing' function from Data.Ord, but for cases where we check equality rather than ordering. Use like: groupBy (equating fst)
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) -- /NAD