[Haskell-cafe] Re: [Haskell-beginners] map question
will_n48 at yahoo.com
Mon Oct 19 20:53:05 EDT 2009
Tom Tobin <korpios <at> korpios.com> writes:
> On Mon, Oct 19, 2009 at 5:34 PM, Will Ness <will_n48 <at> yahoo.com> wrote:
> > 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 whatever).
> If I've accidentally applied syntax meant for a prefix operator to an
> infix operator, *I want the compiler to tell me*, and not to silently
> accept my mistake.
You don't apply sytax, you write it.
You think of functions, where domain matters (for purists?). In syntax only the
result matter, does it read? Does it have an intended meaning?
How is it a mistake if it expresses what I intended?
Both 3 `-` 2 and curry fst `foldl` 0 are exactly the same - expressions with
infix operator, read in the same way, interpreted in the same way. In the first
case the backticks are made superfluous by Haskell reader for our convinience;
but they shouldn't be made illegal. Why should they be? I truly don't
understand the resistance to this idea. :)
> > Why wouldn't it be made legal? Show me one inconsistency it introduces.
> You've said that you want to be able to do this for the sole case of
> the - (minus-sign) operator:
This is not an inconsistence.
Plus, if we were to take this idea of using backticks as names delimeters to
the extreme, it could even allow us to use such identifiers as `left-fold` or
`right-fold` in infix position, and (`left-fold`) by itself. Although that
seems not such a good idea.
> > Operators are great because they make our intent visible, immediately
> > apparent. Long words' meaning, like subtract's, is not immediately apparent,
> > and they break consistency. Not everyone's first language in life was
> > English, you see.
> I don't buy this rationale. Haskell has plenty of English words as
> function names all over the place; if you can't handle "subtract", how
> are you handling Haskell at all? Sure, the minus-sign issue is a
> wart, but it's less awkward than the solution you propose for a
> problem I doubt you really have.
When I see `++` I don't need to think _at_all_. When I see `concatenate` or
some such, I do - even if for a briefest of moments. It is _less_ convinient
both to read and _write_, don't you agree?
I don't see my proposal as awkward at all. On the contrary, to me it looks
natural and consistent with the other uses of this device in the language. It
is this asymmetry that bothers me with the (-) issue, I just want the balance
restored. But it is a matter of taste of course. Or obsessing over minutiae. :)
More information about the Haskell-Cafe