more flexible partial application

Dinko Tenev dinko.tenev at gmail.com
Thu Jan 26 07:13:35 EST 2006


On 1/26/06, Conor McBride <ctm at cs.nott.ac.uk> wrote:
[...]
> We'd do daft stuff like
>
>   (200 * _ ^ 2) unitsquare

Yes, I played with a concept like that at one point, and came to the
conclusion that it was better done with lambdas.  I am all
specifically about function application, not arbitrary expressions.

[...]
> Giving parentheses this murky binding power interferes with their innocence.

The parentheses won't bind, they'll only delimit the expression that
will be subject to re-interpretation, and then simply in a by-the-way
manner, very much like in the operator sections case.  They'll still
be innocent in the absense of relevant syntax :)

> If you do want to pull a stunt like this, you need some other funny
> brackets which specifically indicate this binding power, and then you
> can do grouping inside them, to create larger linear abstractions. You
> could have something like
>
>   (| f (_ * 3) _ |)

We already have lambdas for this, and they're shorter, clearer, and
more powerful.

> But in my wild and foolish adulthood, I'm not sure it's worth spending a
> kind of bracket on.

Definitely not.  But an underscore can still be spent on the much
simpler case :)

>
> All the best
>
> Conor


Cheers,

Dinko


More information about the Haskell-prime mailing list