on master help sign in
Indent ‘then’ and ‘else’ clauses one level further
f94400bmrkkrp
data/examples/declaration/value/function/block-arguments-out.hs+2−2
@@ -20,8 +20,8 @@ f5 =
20f6 =
20f6 =
21 foo
21 foo
22 if bar
22 if bar
23− then baz
23+ then baz
24− else not baz
24+ else not baz
25
25
26f7 = foo \x -> y
26f7 = foo \x -> y
27
27
data/examples/declaration/value/function/case-multi-line-out.hs+2−2
@@ -8,8 +8,8 @@ bar x =
8 case x of
8 case x of
9 5 ->
9 5 ->
10 if x > 5
10 if x > 5
11− then 10
11+ then 10
12− else 12
12+ else 12
13 _ -> 12
13 _ -> 12
14
14
15baz :: Int -> Int
15baz :: Int -> Int
data/examples/declaration/value/function/do-out.hs+2−2
@@ -28,8 +28,8 @@ quux = something $ do
28 2 -> 20
28 2 -> 20
29 bar
29 bar
30 if something
30 if something
31− then x
31+ then x
32− else y
32+ else y
33 baz
33 baz
34
34
35foo = do
35foo = do
data/examples/declaration/value/function/if-multi-line-out.hs+9−9
@@ -1,16 +1,16 @@
1foo :: Int -> Int
1foo :: Int -> Int
2foo x =
2foo x =
3 if x > 5
3 if x > 5
4− then 10
4+ then 10
5− else 12
5+ else 12
6
6
7bar :: Int -> Int
7bar :: Int -> Int
8bar x =
8bar x =
9 if x > 5
9 if x > 5
10− then
10+ then
11− foo x
11+ foo x
12− + 100
12+ + 100
13− else
13+ else
14− case x of
14+ case x of
15− 1 -> 10
15+ 1 -> 10
16− _ -> 20
16+ _ -> 20
data/examples/declaration/value/function/lambda-multi-line-out.hs+2−2
@@ -5,8 +5,8 @@ foo x = \y ->
5bar :: Int -> Int -> Int
5bar :: Int -> Int -> Int
6bar x = \y ->
6bar x = \y ->
7 if x > y
7 if x > y
8− then 10
8+ then 10
9− else 12
9+ else 12
10
10
11tricky0 =
11tricky0 =
12 flip all (zip ws gs) $ \(wt, gt) ->
12 flip all (zip ws gs) $ \(wt, gt) ->
src/Ormolu/Printer/Meat/Declaration/Value.hs+9−8
@@ -538,15 +538,16 @@ p_hsExpr = \case
538 txt "if "
538 txt "if "
539 located if' p_hsExpr
539 located if' p_hsExpr
540 breakpoint
540 breakpoint
541+ inci $ do
541− txt "then"
542+ txt "then"
542− located then' $ \x -> do
543+ located then' $ \x -> do
543− breakpoint
544+ breakpoint
544− inci (p_hsExpr x)
545+ inci (p_hsExpr x)
545− breakpoint
546− txt "else"
547− located else' $ \x -> do
548 breakpoint
546 breakpoint
547+ txt "else"
548+ located else' $ \x -> do
549+ breakpoint
549− inci (p_hsExpr x)
550+ inci (p_hsExpr x)
550 HsMultiIf NoExt guards -> do
551 HsMultiIf NoExt guards -> do
551 txt "if"
552 txt "if"
552 breakpoint
553 breakpoint