haskell / haskell/stylish-haskell

[feature request] Support for defined number of blank lines between top-level declarations

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

Description

After using [elm-format](https://github.com/avh4/elm-format) (the standard elm formatter) I realized that it would be convenient to have the option to enable a defined number of blank lines between top-level declarations, to avoid having places where there is inconsistent spacing between declarations and minimize diffs when refactoring and adding new code.

(I looked through issues and the default config file for an already existing option to enable this, without finding anything)

Hopefully with this option, stylish-haskell would change this:
```haskell
fun :: Num a => a -> a -> a
fun a b = a + b
gun :: t
gun = gun

i :: Integer
i = 0

o :: Integer
o = 0
```

To this (assuming a 2 blank-line separation between declarations):
```haskell
fun :: Num a => a -> a -> a
fun a b = a + b

gun :: t
gun = gun

i :: Integer
i = 0

o :: Integer
o = 0
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating stylish-haskell's configuration handling and the formatter code that separates top-level declarations. Read the existing formatting tests before deciding where the blank-line option belongs. Done means the option produces the two example layouts consistently and has coverage for the configured spacing.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.