On 30/11/2009 17:35, Ian Lynagh wrote:
On Sun, Nov 29, 2009 at 07:40:57PM +0000, Duncan Coutts wrote:
The minimal fix offends me because it uses the 'where' at an odd column
offset. You would never deliberately write it like that, only "fix" it
to be that way.
I don't think offence due to the minimal fix is important, because in
general one would fix it properly. In my tweaks to get validate working
I've mostly stuck with minimal fixes so that the difference in the
layout rule behaviours is clear.
So I'm not convinced. If the tradeoff is between ugly code in my modules
or the status quo of ugly code in ghc's lexer/parser then I'm happy to
stick with the status quo.
Ease of implementation is one motivation for the change, but I think
ease of understanding/explaining the rule should be another. I'm not
sure we have a clear winner here yet; the "parse error" case of the H98
rule is somewhat subtle (and tricky to implement correctly!), but the
alternative rule has a number of somewhat ad-hoc rules.
What the code ends up looking like is important too, of course, but
that is somewhat subjective.
So I think the layout rule should read something like
A layout context can be closed by either
(a) a token indented less than the current indentation level
(b) a closing bracket that matches an open bracket outside the
current layout context
where the set of brackets applying to (b) are (), [], {}, and let..in.
In particular, not commas.
This will throw out a lot of code that currently parses, including
Duncan's case/where example. However, it has the distinct advantage of
being both easy to understand and easy to implement.
Cheers,
Simon
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc