patch applied (ghc): Fix a bug in alternative layout rule
Duncan Coutts
duncan.coutts at googlemail.com
Sun Nov 29 14:40:57 EST 2009
On Fri, 2009-11-27 at 10:28 +0000, Simon Marlow wrote:
> On 26/11/2009 11:50, Ian Lynagh wrote:
> > Wed Nov 25 15:19:01 PST 2009 Ian Lynagh<igloo at earth.li>
> > * Fix a bug in alternative layout rule
> >
> > M ./compiler/parser/Lexer.x +1
>
> Great that you've implemented this. Are you planning to do a proposal
> for Haskell 2011?
> It doesn't particularly bother me that the simpler rule can't handle
> some of the obscure cases.
Here's the main one it cannot cope with that bothers me:
foo x = case bar x of
Pattern1 -> ...
Pattern1 -> ...
where
baz = ...
The new layout requires it to be:
foo x = case bar x of
Pattern1 -> ...
Pattern1 -> ...
where
baz = ...
or the minimal fix:
foo x = case bar x of
Pattern1 -> ...
Pattern1 -> ...
where
baz = ...
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 write quite a bit of code that uses the case patterns and where at the
first tab stop (2-spaces). It seems that many of the changes in the
standard libs are also of this pattern.
Another slightly odd one is:
if p c then do s <- munch p; return (c:s) else pfail
which has to be
if p c then do s <- munch p; return (c:s)
else pfail
or presumably it'd also be ok as:
if p c then (do s <- munch p; return (c:s)) else pfail
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.
Duncan
More information about the Cvs-ghc
mailing list