diff --git a/src/GHC/Util/HsExpr.hs b/src/GHC/Util/HsExpr.hs index 863642fd..8727dba3 100644 --- a/src/GHC/Util/HsExpr.hs +++ b/src/GHC/Util/HsExpr.hs @@ -243,7 +243,7 @@ niceLambdaR parent = go -- e.g., parent = `f \x -> g 3 x`; e = `g 3`. -- Brackets should be placed around `e` to produce `f (g 3)` instead of `f g 3`. addBrackets = case parent of - Just p -> isApp p && not (isVar e) + Just p -> isApp p && not (isVar e) && not (isLambda e) Nothing -> False e' = if addBrackets then mkHsPar e else e tpl = if addBrackets then "(a)" else "a" diff --git a/src/Hint/Lambda.hs b/src/Hint/Lambda.hs index 84c7be3e..6b0fbbeb 100644 --- a/src/Hint/Lambda.hs +++ b/src/Hint/Lambda.hs @@ -43,6 +43,7 @@ f = g \x -> h 3 x -- (h 3) f = g (\x -> h 3 x) -- h 3 f = g \x -> (`h` 3) x -- (`h` 3) f = g \x -> h x -- h +f = ($ 42) \_ -> pure () f = foo (flip op x) -- (`op` x) f = foo (flip op x) -- @Message Use section f = foo (flip x y) -- (`x` y)