[Haskell-cafe] Re: [Haskell-beginners] map question
Tom Tobin
korpios at korpios.com
Mon Oct 19 19:30:48 EDT 2009
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.
> Not a hack, a solution. A consistent one. Look:
>
> (`foldl` 0)
> (`-` 2)
>
> Don't they look exactly the same?
No, because the latter is applying prefix-to-infix syntax to an infix
operator. It's understood that non-alphanumerics are infix by
default, and I want the compiler to scream at me if I try to use one
where it expected a prefix op.
> 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:
> 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. :-)
More information about the Haskell-Cafe
mailing list