... | ... | @@ -30,6 +30,21 @@ Might it be possible to handle `then` and `else` specially to avoid this problem |
|
|
Or might it be possible to treat `if` as something that opens a kind of explicit layout context (which would
|
|
|
prevent the insertion of a closing `}`) that is closed by a matching `else`?
|
|
|
|
|
|
## Implementation
|
|
|
|
|
|
|
|
|
This has been implemented in jhc by changing a single line in the parser, an equivalant change in the report should have the same effect.
|
|
|
|
|
|
```wiki
|
|
|
old:
|
|
|
| 'if' exp 'then' exp 'else' exp { HsIf $2 $4 $6 }
|
|
|
new:
|
|
|
| 'if' exp optsemi 'then' exp optsemi 'else' exp { HsIf $2 $5 $8 }
|
|
|
```
|
|
|
|
|
|
|
|
|
so far, it has not caused any problems.
|
|
|
|
|
|
## References
|
|
|
|
|
|
- Somewhat related to [NondecreasingIndentation](nondecreasing-indentation)
|
... | ... | |