Code blocks should strip alignment of opening brace
- Dominant language
- Haskell
- Stars
- 322
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
Motivated by https://github.com/haskell/happy/issues/303, I think we should offer a command-line flag such that a code block
```
| 'pattern' pattern_synonym_lhs '<-' pat_syn_pat where_decls
{% do { let (name, args, as) = $2
; mg <- mkPatSynMatchGroup name $51 }
```
is turned into
```
do { let (name, args, as) = $2
; mg <- mkPatSynMatchGroup name $51 }
```
instead of
```
do { let (name, args, as) = $2
; mg <- mkPatSynMatchGroup name $51 }
```
That is, try and trim a whitespace prefix from subsequent lines that corresponds to the alignment of `{%`.
I think we can make code blocks entirely insensitive to indentation by wrapping them in `do{...}`. Example:
```
x :: Int
x = do{ 42 } -- works on pure expressions as well
-- code block: {%do putStrLn "this is the"
-- putStrLn "code block"}
main = do
putStrLn "hi"
do{
do putStrLn "this is the"
putStrLn "code block"}
putStrLn "end"
```
Contributor guide
Assessment
This issue has not been assessed yet.