Hang after block arguments
commit118558738b6e333b58c33f94df6b3e99d689537f
authorUtku Demir <me@utdemir.com>
dateFri 16 Aug 2019, 12:24 (7 years ago)
parent682a5f4
data/examples/declaration/value/function/block-arguments-out.hsnew file+24
@@ -0,0 +1,24 @@
1+f1 = foo do bar
2+
3+f2 =
4+ foo do
5+ bar
6+
7+f3 =
8+ foo case True of
9+ True -> bar
10+ False -> baz
11+
12+f4 = foo let a = 3 in b
13+
14+f5 =
15+ foo
16+ let a = 3
17+ b = a
18+ in b
19+
20+f6 =
21+ foo
22+ if bar
23+ then baz
24+ else not baz
data/examples/declaration/value/function/block-arguments.hsnew file+18
@@ -0,0 +1,18 @@
1+f1 = foo do bar
2+
3+f2 = foo do
4+ bar
5+
6+f3 = foo case True of
7+ True -> bar
8+ False -> baz
9+
10+f4 = foo let a = 3 in b
11+
12+f5 = foo let a = 3
13+ b = a
14+ in b
15+
16+f6 = foo if bar
17+ then baz
18+ else not baz
src/Ormolu/Printer/Meat/Declaration/Value.hs+3−2
@@ -470,8 +470,9 @@ p_hsExpr = \case
470470 inci (p_matchGroup LambdaCase mgroup)
471471 HsApp NoExt f x -> sitcc $ do
472472 located f p_hsExpr
473− breakpoint
474− inci (located x p_hsExpr)
473+ -- Second argument can be a `do` or `case` block with `-XBlockArguments`.
474+ placeHanging (exprPlacement (unLoc x)) $
475+ located x p_hsExpr
475476 HsAppType a e -> do
476477 located e p_hsExpr
477478 breakpoint