> Does anybody disagree with my interpretation of the standard? Are
> there any implementations that actually follow the standard here?
> (Maybe the standard should be changed to follow the implementations in
> this area.)
Phew. Well spotted. Of course, none of the existing Haskell
implementations are in conformance here.
I think this has just about convinced me that the parse-error condition is a
really bad idea. The main reason for its inclusion was to allow things like
let f x = x in ...
and also to automatically insert the final '}' before the end of file.
Perhaps the layout rule should be restricted to these two cases?
Proposal:
- replace t by 'in' in the parse-error rule.
EOF is already handled by the last clause in the layout spec. My guess is
that this would break very few programs.
A simpler rule might involve automatically inserting '}' before 'in' during
lexical analysis iff (a) we're in a layout context and (b) the close brace
hasn't already been inserted by the layout rule. This would decouple the
parser and lexer which is a Good Thing.
Cheers,
Simon