Proposal: Adding on

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Thu Nov 2 12:18:25 EST 2006


Nils Anders Danielsson <nad at cs.chalmers.se> wrote:

> (*) `on` f = \x y -> f x * f y
> 
> 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 Control.Function containing on plus (initially) some
> other combinators (working solely on and with functions) from the
> Prelude.

I support the addition of `on`.  I also agree it should be placed with
other combinators that operate purely on functions.

However, the "Control." hierarchy is certainly the wrong place for it.
The very name Control is intended to suggest things that are slightly
outside the usual functional domain - more in the region of imperative
control structures.  Here are some alternative suggestions:

    Data.Function
    Data.Functional
    Prelude.Functional
    Function.Combinators
    Prelude.Combinators

Regards,
    Malcolm


More information about the Libraries mailing list