
Ian Lynagh wrote:
On Thu, Mar 09, 2006 at 04:53:52PM -0000, Simon Marlow wrote:
the problem is that 'let' does not always have a matching 'in', e.g. when it is used in 'do', pattern guards or list comprehensions. So you can't consistently treat let/in as brackets.
Right, I mentioned that in my earlier mail. However, I think this can be handled by rules like
L (<n>:ts) ((Let:bs,m):bsms) = L ts ((bs,m):bsms) if m = n
Here's a tricky case: ... | let x, y :: T x = 3 y = 4, ... The first , shouldn't close the let statement, but the second should. How do you distinguish between them? If you never allow , to close a let statement, then you can no longer write ... | let x = 3, ... Of course, the commas in type signatures and fixity declarations are redundant anyway. If they were dropped from the grammar, this problem would go away.
Incidentally, in my head the "," in "(case x of p -> e, 42)" acts as a right and left bracketing lexeme, so this expression would still be accepted.
Here's another tricky case: (case p of q | r,s -> t, ...) I'm not sure what to do about this one. -- Ben