Oops, PreludeCore cannot be hidden. I guess I've made a fool of myself
(but that happens often :-).
> Can't we find anything more interesting to discuss that the syntax??
You are welcome to! :-) But sweeping syntax matters under the carpet
does not improve anything.
> | ... But what I find a bit strange is that even when + and -
> | are overridden locally n+k and prefix - still have their old meanings.
> | Well, it's just one more exception to the rule to remember about Haskell.
> Yes, but we need to emphasize that rebinding such operators is a Bad Idea.
> (Maybe Phil is right, that we should simply forbid it.)
I agree that it should be forbidden, not for the love of prohibitions,
but in order to detect more errors in programs statically, and to avoid
some quite unnecessary ways to muddle a Haskell program. But there are
several degrees to which rebinding could be forbidden. Here are some
of the alternatives (sorry if you find this confusing/confused :-):
1. Forbidding rebinding + and -.
2. Forbidding rebinding operators/function names exported from
classes in PreludeCore.
(Except in instance declarations, of course.)
3. Forbidding rebinding operators/function names declared by
classes in scope.
(Except...)
4. Forbidding rebinding any name exported by PreludeCore.
5. Forbidding rebinding any name in scope.
I don't like singling out +, -, and PreludeCore more than necessary, so
alternative 3 (plus remark below) or 5 are good candidates in my opinion.
I still think that Lennarts quiz declaration should be illegal at least on the
grounds Paul gave (i.e., even if the name (+) is replaced by some other name):
Names bound by the "lhs"es (in each let/where declaration part)
should not be allowed to be rebound by some argument pattern
within one of the "funlhs"es in the declaration.
Syntactically confused
/kent k