
9 Feb
2005
9 Feb
'05
1:27 p.m.
"Simon Marlow"
On 08 February 2005 12:33, Thomas Jäger wrote:
First of all
-- Cale Gibbard comparing :: (Ord a) => (b -> a) -> b -> b -> Ordering comparing p x y = compare (p x) (p y) fits nicely with the ...By functions from Data.List.
sortBy (comparing fst)
is just too cute not to have. Any objections?
No objection. My version of this is defined in terms of another function which I use directly almost as often, onField :: (fv -> fv -> r) -> (s -> fv) -> s -> s -> r onField op field r1 r2 = field r1 `op` field r2 , which I consider a good candidate for inclusion in a library. (I expect there's a better name, though.) mike