|Reported by:||nad||Owned by:|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
on defined by
(*) `on` f = \x y -> f x * f y
is convenient when using functions like
sortBy (compare `on` fst), for example. It also makes the code more readable.
Furthermore I consider
on to be above the Fairbairn threshold,
- we get rid of two lambdas,
- we get rid of the duplication of p,
onhas some nice algebraic properties (documented in the patch)
- and, most importantly, it is easier at a glance to understand
(*) `on` pthan to understand
\x y -> p x * p y(assuming one knows about
The main question seems to be which module to put the function in. Based on previous discussion on the libraries list I suggest creating a new module
on plus (initially) some other combinators (working solely on and with functions) from the Prelude.
Deadline for discussion: 2006-11-09.