on master help sign in
Use braces when placing `$` on the same line
commit81e60bb342a522f0c11dc671eae600b334e3b344 authorUtku Demir <me@utdemir.com> dateSun 17 Nov 2019, 18:44 (7 years ago) parentcd6c752
3 files changed+18−7
data/examples/declaration/value/function/infix/dollar-chains-out.hs+4 data/examples/declaration/value/function/infix/dollar-chains.hs+4 src/Ormolu/Printer/Meat/Declaration/Value.hs+10−7
data/examples/declaration/value/function/infix/dollar-chains-out.hs+4
@@ -16,3 +16,7 @@ foo =
1616 bar
1717 $ baz
1818 $ quux
19+
20+x =
21+ case l of { A -> B } $
22+ case q of r -> s
data/examples/declaration/value/function/infix/dollar-chains.hs+4
@@ -16,3 +16,7 @@ foo =
1616 bar
1717 $ baz
1818 $ quux
19+
20+x =
21+ case l of { A -> B } $
22+ case q of r -> s
src/Ormolu/Printer/Meat/Declaration/Value.hs+10−7
@@ -1259,21 +1259,24 @@ p_exprOpTree isDollarSpecial s (OpBranch x op y) = do
12591259 gotDollar = case getOpName (unLoc op) of
12601260 Just rname -> mkVarOcc "$" == (rdrNameOcc rname)
12611261 _ -> False
1262− switchLayout [opTreeLoc x]
1263− $ ub
1264− $ p_exprOpTree (not gotDollar) s x
1262+ lhs =
1263+ switchLayout [opTreeLoc x] $
1264+ p_exprOpTree (not gotDollar) s x
12651265 let p_op = located op (opWrapper . p_hsExpr)
12661266 p_y = switchLayout [opTreeLoc y] (p_exprOpTree True N y)
12671267 if isDollarSpecial && gotDollar && placement == Normal && isOneLineSpan (opTreeLoc x)
12681268 then do
1269+ useBraces lhs
12691270 space
12701271 p_op
12711272 breakpoint
12721273 inci p_y
1273− else placeHanging placement $ do
1274− p_op
1275− space
1276− p_y
1274+ else do
1275+ ub lhs
1276+ placeHanging placement $ do
1277+ p_op
1278+ space
1279+ p_y
12771280
12781281-- | Get annotations for the enclosing element.
12791282getEnclosingAnns :: R [AnnKeywordId]