haskell / haskell/stylish-haskell

New option for `list_align` for imports

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

Description

For example I would like to format imports as follows:

```haskell
import qualified Network.HTTP.Client.Internal.Types as Client (Request, host, method, path, port,
queryString, requestBody, requestHeaders)
```

But with current options, I can make it look either like this

```haskell
import qualified Network.HTTP.Client.Internal.Types as Client (Request, host, method, path, port,
queryString, requestBody,
requestHeaders)
```

or like this:

```haskell
import qualified Network.HTTP.Client.Internal.Types as Client
(Request, host, method, path, port, queryString, requestBody, requestHeaders)
```

or

```haskell
import qualified Network.HTTP.Client.Internal.Types as Client (Request, host, method, path, port,
queryString, requestBody,
requestHeaders)
```

None of the existing solutions satisfies what I would like to see. Is it possible to add the option to align imports lines with fixed indentation not depending on the module name length (but also not to start with the new line each time even for 1-line imports)?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the list_align option and the import-formatting entry point in stylish-haskell. Compare the requested fixed indentation with the existing alignment modes, then identify the relevant formatter tests or add coverage for one-line and wrapped imports; done means the new option produces the requested indentation without forcing one-line imports onto a new line.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.