A couple of minor and major changes
I would like to propose a couple of minor and major changes. Some of them are already mentioned in other issues. I would be glad to open a PR (MR) for it
- don't add newlines between derivings
- keep single-line
let
statements - single line (#205) - don't add newlines in multi-line
let
statements - group statements in
where
clause - add indentation in
where
clauses (kinda #140) - keep
=
on the first line in declarations (#224) - don't add newline between different definitions/patterns (at least in where clauses bindings)
Before
data Data
= Joy
| Meh
derive instance dataEq ∷ Eq Data
derive instance dataOrd ∷ Ord Data
type ThisLine
= { random ∷ Data }
example ∷ forall a. a -> Data
example = do
let
dontJump = "toNewLine"
pure Joy
where
whereHasIdentation = true
small = "declaration"
anotherSmall = "declaration"
withType ∷ Int -> Int
withType 1 = 3
withType _ = 42
After
data Data
= Joy
| Meh
derive instance dataEq ∷ Eq Data
derive instance dataOrd ∷ Ord Data
type ThisLine =
{ random ∷ Data }
example ∷ forall a. a -> Data
example = do
let dontJump = "toNewLine"
pure Joy
where
whereHasIdentation = true
small = "declaration"
anotherSmall = "declaration"
withType ∷ Int -> Int
withType 1 = 3
withType _ = 42
Annotated after
data Data
= Joy
| Meh
-- (1)
derive instance dataEq ∷ Eq Data
derive instance dataOrd ∷ Ord Data
-- (6)
type ThisLine =
{ random ∷ Data }
example ∷ forall a. a -> Data
example = do
-- (2)
let dontJump = "toNewLine"
pure Joy
where
-- (4), (5)
whereHasIdentation = true
small = "declaration"
anotherSmall = "declaration"
-- (4), (7)
withType ∷ Int -> Int
withType 1 = 3
withType _ = 42
Edited by Zelenya1