1
1
mirror of https://github.com/google/ormolu.git synced 2025-01-06 06:33:37 +03:00

Make case expressions hanging

This commit is contained in:
mrkkrp 2019-06-06 22:29:50 +02:00 committed by Mark Karpov
parent f937aa7aaf
commit 46d175c89d
2 changed files with 16 additions and 19 deletions

View File

@ -1,25 +1,21 @@
foo :: Int -> Int
foo x =
case x of
5 -> 10
_ -> 12
foo x = case x of
5 -> 10
_ -> 12
bar :: Int -> Int
bar x =
case x of
5 ->
if x > 5
then 10
else 12
_ -> 12
bar x = case x of
5 ->
if x > 5
then 10
else 12
_ -> 12
baz :: Int -> Int
baz x =
case x of
5 -> 10
_ -> 12
baz x = case x of
5 -> 10
_ -> 12
quux :: Int -> Int
quux x =
case x of
x -> x
quux x = case x of
x -> x

View File

@ -279,7 +279,7 @@ p_hsExpr = \case
located e p_hsExpr
txt " of"
breakpoint
inci (p_matchGroup Case mgroup)
p_matchGroup Case mgroup
HsIf NoExt _ if' then' else' -> do
txt "if "
located if' p_hsExpr
@ -447,6 +447,7 @@ isPrefixBlock _ = False
isPrefixBlockExpr :: HsExpr GhcPs -> Bool
isPrefixBlockExpr = \case
HsLam NoExt _ -> True
HsCase NoExt _ _ -> True
HsDo NoExt _ _ -> True
HsLamCase NoExt _ -> True
_ -> False