[Haskell-cafe] Re: Partial Tuple application
Henning Thielemann
lemming at henning-thielemann.de
Fri Jul 14 07:03:29 EDT 2006
On Fri, 14 Jul 2006, Christian Maeder wrote:
> 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.
I see. It would require that ? belongs to tuples exclusively and that it
will never be used elsewhere, say for lists like in [1,2,?]. Because then
the expression [(1,?)] becomes ambigous.
Like with every kind of syntactic sugar, I fear that the next thing that
people request, are expressions like
(1,2,3+?)
for
\x -> (1,2,3+x)
> > 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)
Necessary or not, applied mathematicians don't care about redundancy. :-)
I have seen $f(\cdot)$ instead of $f$ really often, as well as
$f(\cdot-k)$ for \x -> f(x-k).
More information about the Haskell-Cafe
mailing list