Carl Witty wrote about layout horror and reasoned that

>    do { a `elem` b `
> is a legal prefix of the Haskell grammar: it could be completed by
>    do { a `elem` b `seq` c }
> for instance.  So no implicit close-brace gets inserted; and
>    a `elem` b `elem` c
> is a syntax error.

which seems right.
It would be treated the same as the "a == b == c" case if `elem` were
one lexeme, not three.

I already argued (in http://www.dcs.gla.ac.uk/mail-www/haskell/msg01596.html, 
to which I'd really like to know your thoughts) that lexeme's
definition is wrong and should be:

lexeme  -> qvarid | qconid | qvarsym | qconsym
         | literal | special | reservedop | reservedid 

Now we could replace qvarsym and qconsym by qop, and have both
examples parse in the same way. However, unlike the other change in
lexeme's definition, I don't suggest this, I only want to point out
that there is a (formally) simple way out of the present somewhat
inconsistent state.
I like Simon Marlow's solution to have fixity resolution separated
from parsing.

Please don't let this trouble be a reason to abandon layout!



Christian Sievers


Reply via email to