@@ -17,6 +17,7 @@ import Data.Bool (bool)
17import Data.Char (isPunctuation, isSymbol)
17import Data.Char (isPunctuation, isSymbol)
18import Data.Data hiding (Infix, Prefix)
18import Data.Data hiding (Infix, Prefix)
19import Data.List (intersperse, sortOn)
19import Data.List (intersperse, sortOn)
20+import Data.List.NonEmpty (NonEmpty ((:|)))
20import Data.Text (Text)
21import Data.Text (Text)
22import Ormolu.Printer.Combinators
23import Ormolu.Printer.Combinators
@@ -182,7 +183,7 @@ p_match' placer pretty style isInfix strictness m_pats m_grhss = do
182 SplicePat _ _ -> True
183 SplicePat _ _ -> True
183 _ -> False
184 _ -> False
184 txt (if needsSpace then "\\ " else "\\")
185 txt (if needsSpace then "\\ " else "\\")
185− stdCase
186+ sitcc stdCase
186 LambdaCase -> stdCase
187 LambdaCase -> stdCase
187 return inci'
188 return inci'
@@ -946,7 +947,12 @@ cmdTopPlacement = \case
947exprPlacement :: HsExpr GhcPs -> Placement
948exprPlacement :: HsExpr GhcPs -> Placement
948exprPlacement = \case
949exprPlacement = \case
950+ -- Only hang lambdas with single line parameter lists
951+ HsLam NoExt mg -> case mg of
952+ MG _ (L _ [L _ (Match NoExt _ (x:xs) _)]) _
953+ | isOneLineSpan (combineSrcSpans' $ fmap getLoc (x :| xs))
949− HsLam NoExt _ -> Hanging
954+ -> Hanging
950 HsLamCase NoExt _ -> Hanging
956 HsLamCase NoExt _ -> Hanging
951 HsCase NoExt _ _ -> Hanging
957 HsCase NoExt _ _ -> Hanging
952 HsDo NoExt DoExpr _ -> Hanging
958 HsDo NoExt DoExpr _ -> Hanging