H98 Report: expression syntax glitch

Ross Paterson ross@soi.city.ac.uk
Thu, 28 Feb 2002 10:28:03 +0000


On Wed, Feb 27, 2002 at 06:45:45AM -0800, Simon Peyton-Jones wrote:
> So I propose to say that 'let', 'lambda' and 'if' productions have
> a side condition that (say)
> 	let .. in exp
> is syntactially valid only if the phrase is followed by one of the 
> punctuation symbols
> 	)  ]  }  |  ;  ,  ..  where  of  then  else

An alternative is to say that 'let', 'lambda' and 'if' expressions may
not be immediately followed by '::' or qop.

Sadly none of the three solutions distinguishes between

	case x of y | let z = True in z -> y
	case x of y | let z = True in z :: Bool -> y
	case x of y | let z = True in z :: Bool -> y -> z

Hugs, GHC and NHC all accept the first but not the other two.