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

Hang expressions in if-then-else

This commit is contained in:
Utku Demir 2019-08-19 10:42:00 +12:00 committed by Mark Karpov
parent 9a1f5ebd87
commit 8cb86d3fac
3 changed files with 25 additions and 10 deletions

View File

@ -10,7 +10,14 @@ bar x =
then
foo x
+ 100
else
case x of
1 -> 10
_ -> 20
else case x of
1 -> 10
_ -> 20
baz :: Int -> Bar
baz x =
if x > 5
then \case
Foo -> bar
else do
undefined

View File

@ -10,3 +10,13 @@ bar x =
else case x of
1 -> 10
_ -> 20
baz :: Int -> Bar
baz x =
if x > 5
then
\case
Foo -> bar
else
do
undefined

View File

@ -540,14 +540,12 @@ p_hsExpr = \case
breakpoint
inci $ do
txt "then"
located then' $ \x -> do
breakpoint
inci (p_hsExpr x)
located then' $ \x ->
placeHanging (exprPlacement x) (p_hsExpr x)
breakpoint
txt "else"
located else' $ \x -> do
breakpoint
inci (p_hsExpr x)
located else' $ \x ->
placeHanging (exprPlacement x) (p_hsExpr x)
HsMultiIf NoExt guards -> do
txt "if"
breakpoint