Proposal: AlternativeLayoutRule
Ticket | #134 |
---|---|
Dependencies | |
Related |
Compiler support
GHC | full (`-XAlternativeLayoutRule`) |
---|---|
nhc98 | none |
Hugs | none |
UHC | none |
JHC | none |
LHC | none |
Summary
A short summary of the extension/modification.
Description
Originally formulated by John Meacham, and a standalone implementation written:
- http://www.mail-archive.com/haskell-prime@haskell.org/msg01938.html
darcs get http://repetae.net/repos/getlaid/
Implemented (with slight differences) in GHC HEAD (6.13) as the AlternativeLayoutRule
extension.
One bug, going right back to the original definition, is that
foo = let { x = x } in x
gets translated into
foo = let { x = x } } in x
This has been fixed in the GHC code.
Additionally, there has been some discussion as to how the rule should behave exactly. In particular, some people believe that it would be better to keep the rule simple by not doing anything with commas, at the cost of rejecting more H98 code. It would be possible to transition to this, by issuing a warning if the new comma rules are needed.
Another GHC flag, -XAlternativeLayoutRuleTransitional
, accepts more H98 programs, but warns when it does so.
Some differences between the H98 and this rule are exercised by tests in the layout
section of GHC's testsuite.
References
Definition:
http://www.mail-archive.com/haskell-prime@haskell.org/msg01938.html
darcs get http://repetae.net/repos/getlaid/
Discussion on effect:
http://www.haskell.org/pipermail/cvs-ghc/2009-November/051542.html (discussion continues (unlinked) into December)
Report Delta
Not yet written.