|
|
|
# Proposal: AlternativeLayoutRule
|
|
|
|
|
|
|
|
<table><tr><th> Ticket </th>
|
|
|
|
<th>[\#134](https://gitlab.haskell.org//haskell/prime/issues/134)</th></tr>
|
|
|
|
<tr><th> Dependencies </th>
|
|
|
|
<th></th></tr>
|
|
|
|
<tr><th> Related </th>
|
|
|
|
<th></th></tr></table>
|
|
|
|
|
|
|
|
## Compiler support
|
|
|
|
|
|
|
|
<table><tr><th> GHC </th>
|
|
|
|
<th> full (`-XAlternativeLayoutRule`)
|
|
|
|
</th></tr>
|
|
|
|
<tr><th> nhc98 </th>
|
|
|
|
<th> none
|
|
|
|
</th></tr>
|
|
|
|
<tr><th> Hugs </th>
|
|
|
|
<th> none
|
|
|
|
</th></tr>
|
|
|
|
<tr><th> UHC </th>
|
|
|
|
<th> none
|
|
|
|
</th></tr>
|
|
|
|
<tr><th> JHC </th>
|
|
|
|
<th> none
|
|
|
|
</th></tr>
|
|
|
|
<tr><th> LHC </th>
|
|
|
|
<th> none
|
|
|
|
</th></tr></table>
|
|
|
|
|
|
|
|
## 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](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
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
foo = let { x = x } in x
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
gets translated into
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
foo = let { x = x } } in x
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
This needs to be resolved before we can proceed.
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
Some differences between the H98 and this rule are exercised by tests in the `layout` section of GHC's testsuite.
|
|
|
|
|
|
|
|
## References
|
|
|
|
|
|
|
|
[ http://www.mail-archive.com/haskell-prime\@haskell.org/msg01938.html](http://www.mail-archive.com/haskell-prime@haskell.org/msg01938.html)
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
darcs get http://repetae.net/repos/getlaid/
|
|
|
|
```
|
|
|
|
|
|
|
|
## Report Delta
|
|
|
|
|
|
|
|
|
|
|
|
Not yet written. |