@@ -111,8 +111,10 @@ instance Pretty def => Pretty (Expr' def) where
111111 P.text "-" <> prettyParens e
112112 Binop op e1 e2 -> P.sep [ prettyParens e1 <+> P.text op', prettyParens e2 ]
113113 where op' = if Help.isOp op then op else "`" ++ op ++ "`"
114− Lambda p e -> let (ps,body) = collectLambdas (Location.none $ Lambda p e)
115− in P.text "\\" <> P.sep ps <+> P.text "->" <+> pretty body
114+ Lambda p e -> P.text "\\" <> args <+> P.text "->" <+> pretty body
115+ where
116+ (ps,body) = collectLambdas (Location.none $ Lambda p e)
117+ args = P.sep (map Pattern.prettyParens ps)
116118 App _ _ -> P.hang func 2 (P.sep args)
117119 where func:args = map prettyParens (collectApps (Location.none expr))
118120 MultiIf branches -> P.text "if" $$ nest 3 (vcat $ map iff branches)
@@ -179,12 +181,11 @@ collectApps lexpr@(Location.L _ expr) =
179181 App a b -> collectApps a ++ [b]
180182 _ -> [lexpr]
181183
182−collectLambdas :: LExpr' def -> ([Doc], LExpr' def)
184+collectLambdas :: LExpr' def -> ([Pattern.Pattern], LExpr' def)
183185collectLambdas lexpr@(Location.L _ expr) =
184186 case expr of
185− Lambda pattern body ->
186− let (ps, body') = collectLambdas body
187− in (pretty pattern : ps, body')
187+ Lambda pattern body -> (pattern : ps, body')
188+ where (ps, body') = collectLambdas body
188189 _ -> ([], lexpr)
189190
190191prettyParens :: (Pretty def) => LExpr' def -> Doc