[Haskell-cafe] Re: Partial Tuple application (Was: Comma in the front)

Christian Maeder maeder at tzi.de
Fri Jul 14 06:35:53 EDT 2006


Henning Thielemann schrieb:
>> in haskell-prime list there was a proposal to use '?' for such things:
>>
>> (1,2,?)
>>
>> only problem is what it's hard to define exactly where the lambda
>> should arise:

the placeholder '?' becomes part of a new implicit identifier (that
exceeds Haskell's identifier syntax). If we have:

(,,) :: a -> b -> c -> (a, b, c)

we get a bunch of new identifiers:

(?,,) :: b -> c -> a -> (a, b, c)
(,?,) :: a -> c -> b -> (a, b, c)
(,,?) :: a -> b -> c -> (a, b, c)

And maybe also:
(?,?,) :: c -> a -> b -> (a, b, c)

and so on. For infix ops this looks natural to me.

>>
>> (1,2,\x->x)

I see no reason for this interpretation.

>> (\x -> (1,2,x))

That should exactly be the implicit definition of my above implicit
identifiers.

> Yes that's a really evil problem that I already encountered in
> mathematics. Some mathematicians like to write f(·) or even f(·-k) which
> exhibits exactly the ambiguity you mention. Such placeholders are a really
> bad idea.

"f(?)" should not make sense in Haskell, since the parens do not belong
to the identifier "f". (It's also not necessary: \ x -> f(x) = f)

Cheers Christian


More information about the Haskell-Cafe mailing list