Change formatting of operators and infix constructors
This formatting scheme is more appropriate if you think of chaining multiple
infix expressions and combining it with do-blocks. The operator should hang
on previous line instead going first on the next line, e.g.:
foo +
bar
instead of
foo
+ bar
commit1b287b3b0d909a74279cb3850c9ab8480d39a261
authormrkkrp <mark.karpov@tweag.io>
dateWed 5 Jun 2019, 20:30 (7 years ago)
parentf27a6ab
data/examples/declaration/value/function/guards-out.hs+4−4
@@ -6,9 +6,9 @@ foo x
66bar :: Int -> Int
77bar x
88 | x == 5 =
9− foo x
10− + foo 10
9+ foo x +
10+ foo 10
1111 | x == 6 =
12− foo x
13− + foo 20
12+ foo x +
13+ foo 20
1414 | otherwise = foo 100
data/examples/declaration/value/function/if-multi-line-out.hs+4−4
@@ -8,8 +8,8 @@ bar :: Int -> Int
88bar x =
99 if x > 5
1010 then
11− foo x
12− + 100
11+ foo x +
12+ 100
1313 else
14− foo x
15− + 200
14+ foo x +
15+ 200
data/examples/declaration/value/function/let-multi-line-out.hs+2−2
@@ -8,5 +8,5 @@ bar :: Int -> Int
88bar x =
99 let z = y
1010 y = x
11− in z
12− + 100
11+ in z +
12+ 100
src/Ormolu/Printer/Meat/Declaration/Pat.hs+3−4
@@ -56,11 +56,10 @@ p_pat = \case
5656 braces $ velt (withSep comma (located' p_hsRecField) fields)
5757 InfixCon x y -> do
5858 located x p_pat
59+ space
60+ p_rdrName pat
5961 breakpoint
60− inci $ do
61− p_rdrName pat
62− space
63− located y p_pat
62+ inci (located y p_pat)
6463 ConPatOut {} -> notImplemented "ConPatOut"
6564 ViewPat {} -> notImplemented "ViewPat"
6665 SplicePat {} -> notImplemented "SplicePat"
src/Ormolu/Printer/Meat/Declaration/Value.hs+3−4
@@ -216,11 +216,10 @@ p_hsExpr = \case
216216 located (hswc_body a) p_hsType
217217 OpApp NoExt x op y -> do
218218 located x p_hsExpr
219+ space
220+ located op p_hsExpr
219221 breakpoint
220− inci $ do
221− located op p_hsExpr
222− space
223− located y p_hsExpr
222+ inci (located y p_hsExpr)
224223 NegApp NoExt e _ -> do
225224 txt "-"
226225 located e p_hsExpr