remark on hugs for Re: prefix minus and infix resolution
Christian Maeder
Christian.Maeder at dfki.de
Mon Jul 12 04:30:25 EDT 2010
Christian Maeder schrieb:
[...]
> Without this restriction polynomials like
> "- a + - b * x + - c * - x ^ 2"
> would uniquely resolve to
> "((- a) + (- (b * x))) + (- (c * (- (x ^ 2))))"
>
> I think hugs handles this correctly!
yes it does this case.
>
> Let us assume a user-defined (non- or) right-associative operator "#"
> with the same precedence as "+" and "-" (infix[r] 6 #).
>
> 3.c) both "- a # b" and "a # - b" are rejected,
> because "#" is not left-associative (like "-").
hugs rejects only the case "- a # b":
ERROR - Ambiguous use of unary minus with "(#)"
So hugs still considers associativity for "-" (but does not consider the
operator to the left of an unary minus.)
C.
> This unnecessary restriction rules out a (user-defined) polynomial like
> "- a # - b * x"
More information about the Haskell-prime
mailing list