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:
parent
da0b3b8565
commit
f94400b486
@ -20,8 +20,8 @@ f5 =
|
||||
f6 =
|
||||
foo
|
||||
if bar
|
||||
then baz
|
||||
else not baz
|
||||
then baz
|
||||
else not baz
|
||||
|
||||
f7 = foo \x -> y
|
||||
|
||||
|
@ -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
|
||||
|
@ -28,8 +28,8 @@ quux = something $ do
|
||||
2 -> 20
|
||||
bar
|
||||
if something
|
||||
then x
|
||||
else y
|
||||
then x
|
||||
else y
|
||||
baz
|
||||
|
||||
foo = do
|
||||
|
@ -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
|
||||
|
@ -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) ->
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user