more flexible partial application
dinko.tenev at gmail.com
Thu Jan 26 05:34:26 EST 2006
On 1/26/06, John Hughes <rjmh at cs.chalmers.se> wrote:
> I'd be against this--its semantics isn't clear enough to me. For example,
> I 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. Please, no!
They should be different for this to work.
The reasonable thing to do would be to rewrite every
(e _ a1 a2 ... an)
(\x -> (e x a1 a2 ... an))
and the parentheses should be mandatory.
Note that this can be done recursively, so that e.g.
(f _ y _ t) ==> (\x1 -> (f x1 y _ t)) ==> (\x1 -> (\x2 -> (f
x1 y x2 t)))
I see this as no worse than operator sections: we already have (- x)
and (-) x meaning different things. Having in mind that (e _ ...) is
just syntax, it should be easy to keep it separate from application,
so f x y z will still be the same as ((f x) y) z.
More information about the Haskell-prime