haskell / haskell/stylish-haskell

imports long list align + list align behaviour regression when set to newline

Open
#462 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1k
Forks
153
PR merge metrics
No merged PRs in 30d

Description

In version 0.11.0.3, a configuration containing
```
list_align: new_line
long_list_align: new_line_multiline
```
was producing a nice consistent layout with all imported stuff in a new line and longer than 80 import lines broken in multiple lines

i.e. this test would have passed
``` haskell
case26b :: Assertion
case26b =
assertSnippet (step (Just 80) options)
[ "import Data.Map (Map)"
, "import Data.List (concat, foldl, foldr, head, init, last, length, map, null, reverse, tail, (++))"
]
[ "import Data.List"
, " ( concat"
, " , foldl"
, " , foldr"
, " , head"
, " , init"
, " , last"
, " , length"
, " , map"
, " , null"
, " , reverse"
, " , tail"
, " , (++)"
, " )"
, "import Data.Map"
, " (Map)"
]
where
options = defaultOptions { listAlign = NewLine, importAlign = None, longListAlign = Multiline}
```
But now, on 0.14.5.0, I cannot reproduce it. In fact, I get

```
expected:
import Data.List
( concat
, foldl
, foldr
, head
, init
, last
, length
, map
, null
, reverse
, tail
, (++)
)
import Data.Map
(Map)

but got:
import Data.List
( concat
, foldl
, foldr
, head
, init
, last
, length
, map
, null
, reverse
, tail
, (++)
)
import Data.Map (Map)
```
where the `(Map)` is not on a new line.

also, without the `longListAlign` , the `listAlign` option is respected

i.e. this test passes
```haskell
case26a :: Assertion
case26a =
assertSnippet (step (Just 80) options)
[ "import Data.Map (Map)"
, "import Data.List (concat, foldl, foldr, head, init, last, length, map, null, reverse, tail, (++))"
]
[ "import Data.List"
, " (concat, foldl, foldr, head, init, last, length, map, null, reverse, tail,"
, " (++))"
, "import Data.Map"
, " (Map)"
]
where
options = defaultOptions { listAlign = NewLine, importAlign = None}
```

Maybe I need a different combination of the options? Any help appreciated

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.