fixity resolution
Simon Marlow
marlowsd at gmail.com
Thu Jul 8 04:09:16 EDT 2010
On 07/07/2010 18:03, Christian Maeder wrote:
> Simon Marlow schrieb:
> [...]
>>> 1. "- 1 * 1" is accepted as legal pattern, but differently resolved for
>>> expressions! Should one not reject these (rare) patterns, too?
>>
>> That's the GHC bug, right?
>
> Yes!
Just a meta point, but it would help me a great deal if you could
clearly separate discussion of what GHC does from discussion of the
standard, i.e. by using the different mailing lists.
>>> 2. I would rather allow "1 * - 1" and "1 + - 1" to be legal as
>>> expressions (with its unambiguous interpretation).
>>
>> Yes, me too, but that's a matter for a new proposal.
>>
>>> 3. Associativity should not matter for the non-binary "-"!
>>>
>>> So the following resolutions are possible:
>>>
>>> "1 + - 2 + 3" ~~~> "(1 + -2) + 3"
>>> "1 + - 2 * 3" ~~~> "1 + -(2 * 3)"
>>>
>>> infix 6 ## -- same precedence like "+" but different associativity
>>>
>>> "- 1 ## 2" ~~~> "(-1) ## 2"
>>
>> Yes, again I agree. The current fixity resolution is more strict than
>> it needs to be. The intention in Haskell 2010 was not to change the way
>> fixity resolution worked, but rather to avoid the problems caused by
>> having it as part of the grammar.
>
> The grammar (in particular an ambiguous one) describes a superset of the
> language and need not change with a changed fixity resolution (or type
> analysis).
Please make a proposal (or proposals), then we can discuss exactly the
changes you'd like to make.
Cheers,
Simon
More information about the Haskell-prime
mailing list