lspitzner / lspitzner/brittany

List in last line of do-block prevents formatting

Open
#296 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug hs:do-notation hs:lists layouting
Dominant language
Haskell
Stars
686
Forks
69
PR merge metrics
No merged PRs in 30d

Description

I have the following function:

```haskell
wnums :: [Double] -> [Double]
wnums nums = do
a <- nums
b <- nums \\ [a]
c <- nums \\ [a, b]
d <- nums \\ [a, b, c]
o1 <- opts
o2 <- opts
o3 <- opts
[ (a `o1` b) `o2` (c `o3` d)
, ((a `o1` b) `o2` c) `o3` d
, a `o1` (b `o2` (c `o3` d))
, (a `o1` (b `o2` c)) `o3` d
, a `o1` ((b `o2` c) `o3` d)
]
```

This function compiles but when i run brittany on the source file then it errors out with `ERROR: brittany pretty printer returned syntactically invalid result.`

Without this function the source file can be reformatted just fine.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by adding the Haskell function from the issue to a source file and running brittany on it. Inspect the formatter output and its syntax validity; done means this do-block formats successfully without the syntactically invalid result error.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.