[Haskell-cafe] Re: [Haskell-beginners] map question
will_n48 at yahoo.com
Mon Oct 19 18:34:08 EDT 2009
wren ng thornton <wren <at> freegeek.org> writes:
> Will Ness wrote:
> > (`foldl`2) works.
> > (`-`2) should too.
> The `` syntax is for converting lexical identifiers into infix
> operators. Symbolic identifiers are already infix, which is why ``
So it would be a no-op then. Why make it illegal? Just because it makes writing
the scanner easier is no answer.
> doesn't work for them. If we introduced this then those striving for
> consistency would be right in requesting that this pattern be allowed
> for all symbolic operators. I for one am opposed to introducing
> superfluous syntax for duplicating the current ability to write things
> in the same ways.
This syntax already exists. The '`' symbol is non-collating already, so using
it for symbol chars doesn't change anything (it's not that it can be a part of
some name, right?). To turn an infix op into an infix op is an id operation,
made illegal artificially at the scan phase after a successful lex (or
Finally enabling the missing functionality which is a common stumbling block
for every beginner is hardly "duplicating".
> Attack the underlying problem, don't introduce hacks to cover up broken
> hacks. This isn't C++.
The underlying problem is a broken scanner where it can't distinguish between a
binary op and a number read syntax. Op names are collated symbol chars, and one
of the symbols, -, is also a valid number prefix. So, allow for a clues from
programmer to detach it from the number: backticks separate it from the
following numeric chars, preventing it from "sticking" to them. And by itself,
it forms an op, a binary one.
Not a hack, a solution. A consistent one. Look:
Don't they look exactly the same?
Why wouldn't it be made legal? Show me one inconsistency it introduces.
More information about the Haskell-Cafe