more flexible partial application
lennart at augustsson.net
lennart at augustsson.net
Mon Jan 23 14:05:06 EST 2006
I don't think the second one makes sense. You would have
to know something about foo to expand it into the second.
But you might not, e.g.,
bar f x w = f x _ _ w
-- Lennart
Quoting Sebastian Sylvan <sebastian.sylvan at gmail.com>:
> On 1/23/06, Andres Loeh <loeh at iai.uni-bonn.de> wrote:
>> > 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 too
>> >
>> > > 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.
>>
>> I just want to make sure I understand this.
>>
>> What would
>>
>> > foo x y z = \w -> ...
>> > bar x w = foo x _ _ w
>>
>> mean?
>>
>> > bar x w = \y z -> foo x y z w
>>
>> or
>>
>> > bar x w = (\y z -> foo x y z) w
>>
>
> I'm not sure. :-)
> The first one seems to make more sense to me, but the second does make
> sense as well. So maybe the expansion should occur at the application
> site. I.e. walk along all the parameters to the function lifting each
> _ to an outer lambda expression (a la the first one).
>
> I'm not sure exactly the best way for this to behave.
>
> /S
> --
> Sebastian Sylvan
> +46(0)736-818655
> UIN: 44640862
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at haskell.org
> http://haskell.org/mailman/listinfo/haskell-prime
>
More information about the Haskell-prime
mailing list