Second draft of the Haskell 2010 report available
Simon Marlow
marlowsd at gmail.com
Wed Jul 7 15:32:25 EDT 2010
On 07/07/10 16:56, Christian Maeder wrote:
> Simon Marlow schrieb:
>> prefix negation should move to lexp to
>> be consistent with lpat
>
> prefix negation should not move to lexp, because this would rule out
> "- 1 ^ 2" as negated infix expression "- (1 ^ 2)",
It wouldn't - remember the grammar just parses infix expressions as a
list, they get rearranged by fixity resolution.
I'm arguing that the current grammar is halfway between two consistent
positions: one in which prefix negation is lexp, the other is your
proposal to make the grammar ambiguous. So we should do one or the other.
> whereas a negated
> infix pattern is impossible. Unary minus is no constructor and cannot be
> defined. The latter should be (or is already?) mentioned somewhere.
>
> You could move prefix negation to lexp, if you allow the fixity
> resolution to construct negated infix expression that are not covered by
> the grammar (as currently happens anyway).
Right, that's what I'm saying. No change needed to fixity resolution,
just move prefix negation into lexp.
> Moving prefix negation from lpat to pat to be consistent with infixexp
> would be overkill, though.
Yes.
Cheers,
Simon
More information about the Haskell-prime
mailing list