Closed waj closed 3 years ago
I pushed a fix for this specific problem in amesgen/issue-707
, but the problem goes deeper:
Consider this:
```haskell foo = case 1 of 1 -> (+1) 1 ``` | ```haskell foo = do case 1 of 1 -> (+1) 1 ``` |
Note that both are valid Haskell code with BlockArguments
(foo == 2
). Formatting them (the second snippet needs --unsafe
) results in
```haskell foo = case 1 of 1 -> (+1) 1 ``` | ```haskell foo = do case 1 of 1 -> (+1) 1 ``` |
and one can see the problem here.
This seems to be a bit similar to #488, and indeed, we could fix this by formatting case
blocks with four spaces of indentation and its arguments with two spaces:
```haskell foo = case 1 of 1 -> (+1) 1 ``` | ```haskell foo = do case 1 of 1 -> (+1) 1 ``` |
But this would cause an enormous amount of reformatting, so I am not sure if this is a good idea.
Another instance of the same problem:
foo = do
do
(+1)
1
The least bad solution for the examples above seems to be indenting the arguments by 1, so e.g.
foo = do
do
(+1)
1
is a fixed point. I implemented this in #731, let's see how it goes.
Describe the bug A multiline splice in a
do
block followed with an argument fails with a different ASTTo Reproduce Try to format this code:
Environment