Haskell 98 sections

Simon Peyton-Jones simonpj@microsoft.com
Fri, 4 Jan 2002 02:22:06 -0800


Folks,

You have all been eating too much Xmas pudding.   Only one=20
Haskell98 Report issue has arisen since my release of 21 Dec. =20

The issue is this: Section 3.5 says that

	(a + b +)=20

is a valid operator section (meaning  \x -> a + b + x) because
(+) is right associative.  But this is contradicted by the actual
syntax, which only has the productions:=20

aexp ::=3D '(' exp(i+1) qop(a,i) ')'
	|  '(' qop(a,i) exp(i+1) ')'

(Here 'a' ranges over the possible operator associativities
of left, right, non-assoc, while i ranges over precendence levels.)

This is clearly an inconsistency.  I propose to fix the syntax in the
way proposed by Simon and Ian (in a thread on GHC-bugs), by
adding the following productions for aexp.

	'(' lexp(i) qop(l,i) ')'
	'(' qop(r,i) rexp(i) ')'

This actually follows the way that qfunlhs is defined.
There is no ambiguity, because an exp(i+1) is not an lexp(i).

This should bring the formal syntax into line with the=20
words in Section 3.5.

Can anyone think of a reason why this won't work?

Simon