on master help sign in
Make case expressions hanging
commit46d175c89d8e8ee510152df386e6978aa567596c authormrkkrp <mark.karpov@tweag.io> dateThu 6 Jun 2019, 22:29 (7 years ago) parentf937aa7
2 files changed+16−19
data/examples/declaration/value/function/case-multi-line-out.hs+14−18 src/Ormolu/Printer/Meat/Declaration/Value.hs+2−1
data/examples/declaration/value/function/case-multi-line-out.hs+14−18
@@ -1,25 +1,21 @@
11foo :: Int -> Int
2−foo x =
3− case x of
4− 5 -> 10
5− _ -> 12
2+foo x = case x of
3+ 5 -> 10
4+ _ -> 12
65
76bar :: Int -> Int
8−bar x =
9− case x of
10− 5 ->
11− if x > 5
12− then 10
13− else 12
14− _ -> 12
7+bar x = case x of
8+ 5 ->
9+ if x > 5
10+ then 10
11+ else 12
12+ _ -> 12
1513
1614baz :: Int -> Int
17−baz x =
18− case x of
19− 5 -> 10
20− _ -> 12
15+baz x = case x of
16+ 5 -> 10
17+ _ -> 12
2118
2219quux :: Int -> Int
23−quux x =
24− case x of
25− x -> x
20+quux x = case x of
21+ x -> x
src/Ormolu/Printer/Meat/Declaration/Value.hs+2−1
@@ -279,7 +279,7 @@ p_hsExpr = \case
279279 located e p_hsExpr
280280 txt " of"
281281 breakpoint
282− inci (p_matchGroup Case mgroup)
282+ p_matchGroup Case mgroup
283283 HsIf NoExt _ if' then' else' -> do
284284 txt "if "
285285 located if' p_hsExpr
@@ -447,6 +447,7 @@ isPrefixBlock _ = False
447447isPrefixBlockExpr :: HsExpr GhcPs -> Bool
448448isPrefixBlockExpr = \case
449449 HsLam NoExt _ -> True
450+ HsCase NoExt _ _ -> True
450451 HsDo NoExt _ _ -> True
451452 HsLamCase NoExt _ -> True
452453 _ -> False