on master help sign in
Shift ‘in’ in ‘let’ to the right to allow placing it in do blocks

It is a bit uncommon to format it like this, but this way it can be placed without changes in do blocks as well. I think it's the right way go about that bug.

commit3d74f2fb53c1af024254b7d28f9d2a14176604fe authormrkkrp <mark.karpov@tweag.io> dateSun 7 Jul 2019, 14:08 (7 years ago) parent01486ed
4 files changed+14−4
data/examples/declaration/value/function/do-out.hs+5 data/examples/declaration/value/function/do.hs+5 data/examples/declaration/value/function/let-multi-line-out.hs+3−3 src/Ormolu/Printer/Meat/Declaration/Value.hs+1−1
data/examples/declaration/value/function/do-out.hs+5
@@ -47,3 +47,8 @@ foo = do
4747 print x
4848 y <- c
4949 print y
50+
51+trickyLet = do
52+ foo
53+ let x = 5
54+ in bar x
data/examples/declaration/value/function/do.hs+5
@@ -46,3 +46,8 @@ foo = do
4646
4747 y <- c
4848 print y
49+
50+trickyLet = do
51+ foo
52+ let x = 5
53+ in bar x
data/examples/declaration/value/function/let-multi-line-out.hs+3−3
@@ -2,11 +2,11 @@ foo :: Int -> Int
22foo x =
33 let z = y
44 y = x
5− in z + 100
5+ in z + 100
66
77bar :: Int -> Int
88bar x =
99 let z = y
1010 y = x
11− in z +
12− 100
11+ in z +
12+ 100
src/Ormolu/Printer/Meat/Declaration/Value.hs+1−1
@@ -459,7 +459,7 @@ p_hsExpr = \case
459459 HsLet NoExt localBinds e -> do
460460 txt "let "
461461 sitcc (located localBinds p_hsLocalBinds)
462− breakpoint
462+ vlayout space (newline >> space)
463463 txt "in "
464464 sitcc (located e p_hsExpr)
465465 HsDo NoExt ctx es -> do