wiki:FlexiblePartialApplication

Version 2 (modified by malcolm.wallace@…, 10 years ago) (diff)

--

Flexible Partial Application

Are there any subtle reasons for why something like the following couldn't be allowed?

> foo x y z w = ...
> bar x w = foo x _ _ w

I.e. a more flexible version of partial application. This would be translated to

> bar x w = \y z -> foo x y z w

I.e a function which takes the "_" parameters in the same order they were encountered in the function application.

Related proposals

Pros

Cons

One can usually assume id e = e, for any e, but

id (f _ x) y  ===  id (\y->f y x) y === f y x
/=
f _ x y === \z -> f z x y

Or would (f _ x) y and f _ x y maybe be different? That would fix the problem above, while introducing another.