Indent ‘then’ and ‘else’ clauses one level further
This arguably improves readability especially when if-then-else is placed
inside of a ‘do’-block.
commitf94400b4860df45fcd72420401393f98abc38445
authormrkkrp <mark.karpov@tweag.io>
dateFri 16 Aug 2019, 22:24 (7 years ago)
parentda0b3b8
data/examples/declaration/value/function/block-arguments-out.hs+2−2
@@ -20,8 +20,8 @@ f5 =
2020f6 =
2121 foo
2222 if bar
23− then baz
24− else not baz
23+ then baz
24+ else not baz
2525
2626f7 = foo \x -> y
2727
data/examples/declaration/value/function/case-multi-line-out.hs+2−2
@@ -8,8 +8,8 @@ bar x =
88 case x of
99 5 ->
1010 if x > 5
11− then 10
12− else 12
11+ then 10
12+ else 12
1313 _ -> 12
1414
1515baz :: Int -> Int
data/examples/declaration/value/function/do-out.hs+2−2
@@ -28,8 +28,8 @@ quux = something $ do
2828 2 -> 20
2929 bar
3030 if something
31− then x
32− else y
31+ then x
32+ else y
3333 baz
3434
3535foo = do
data/examples/declaration/value/function/if-multi-line-out.hs+9−9
@@ -1,16 +1,16 @@
11foo :: Int -> Int
22foo x =
33 if x > 5
4− then 10
5− else 12
4+ then 10
5+ else 12
66
77bar :: Int -> Int
88bar x =
99 if x > 5
10− then
11− foo x
12− + 100
13− else
14− case x of
15− 1 -> 10
16− _ -> 20
10+ then
11+ foo x
12+ + 100
13+ else
14+ case x of
15+ 1 -> 10
16+ _ -> 20
data/examples/declaration/value/function/lambda-multi-line-out.hs+2−2
@@ -5,8 +5,8 @@ foo x = \y ->
55bar :: Int -> Int -> Int
66bar x = \y ->
77 if x > y
8− then 10
9− else 12
8+ then 10
9+ else 12
1010
1111tricky0 =
1212 flip all (zip ws gs) $ \(wt, gt) ->
src/Ormolu/Printer/Meat/Declaration/Value.hs+9−8
@@ -538,15 +538,16 @@ p_hsExpr = \case
538538 txt "if "
539539 located if' p_hsExpr
540540 breakpoint
541− txt "then"
542− located then' $ \x -> do
543− breakpoint
544− inci (p_hsExpr x)
545− breakpoint
546− txt "else"
547− located else' $ \x -> do
541+ inci $ do
542+ txt "then"
543+ located then' $ \x -> do
544+ breakpoint
545+ inci (p_hsExpr x)
548546 breakpoint
549− inci (p_hsExpr x)
547+ txt "else"
548+ located else' $ \x -> do
549+ breakpoint
550+ inci (p_hsExpr x)
550551 HsMultiIf NoExt guards -> do
551552 txt "if"
552553 breakpoint