1
1
mirror of https://github.com/google/ormolu.git synced 2024-11-27 13:13:23 +03:00

Indent ‘then’ and ‘else’ clauses one level further

This arguably improves readability especially when if-then-else is placed
inside of a ‘do’-block.
This commit is contained in:
mrkkrp 2019-08-16 22:24:11 +02:00 committed by Mark Karpov
parent da0b3b8565
commit f94400b486
6 changed files with 26 additions and 25 deletions

View File

@ -20,8 +20,8 @@ f5 =
f6 =
foo
if bar
then baz
else not baz
then baz
else not baz
f7 = foo \x -> y

View File

@ -8,8 +8,8 @@ bar x =
case x of
5 ->
if x > 5
then 10
else 12
then 10
else 12
_ -> 12
baz :: Int -> Int

View File

@ -28,8 +28,8 @@ quux = something $ do
2 -> 20
bar
if something
then x
else y
then x
else y
baz
foo = do

View File

@ -1,16 +1,16 @@
foo :: Int -> Int
foo x =
if x > 5
then 10
else 12
then 10
else 12
bar :: Int -> Int
bar x =
if x > 5
then
foo x
+ 100
else
case x of
1 -> 10
_ -> 20
then
foo x
+ 100
else
case x of
1 -> 10
_ -> 20

View File

@ -5,8 +5,8 @@ foo x = \y ->
bar :: Int -> Int -> Int
bar x = \y ->
if x > y
then 10
else 12
then 10
else 12
tricky0 =
flip all (zip ws gs) $ \(wt, gt) ->

View File

@ -538,15 +538,16 @@ p_hsExpr = \case
txt "if "
located if' p_hsExpr
breakpoint
txt "then"
located then' $ \x -> do
inci $ do
txt "then"
located then' $ \x -> do
breakpoint
inci (p_hsExpr x)
breakpoint
inci (p_hsExpr x)
breakpoint
txt "else"
located else' $ \x -> do
breakpoint
inci (p_hsExpr x)
txt "else"
located else' $ \x -> do
breakpoint
inci (p_hsExpr x)
HsMultiIf NoExt guards -> do
txt "if"
breakpoint