@@ -111,8 +111,10 @@ instance Pretty def => Pretty (Expr' def) where
111 P.text "-" <> prettyParens e
111 P.text "-" <> prettyParens e
112 Binop op e1 e2 -> P.sep [ prettyParens e1 <+> P.text op', prettyParens e2 ]
112 Binop op e1 e2 -> P.sep [ prettyParens e1 <+> P.text op', prettyParens e2 ]
113 where op' = if Help.isOp op then op else "`" ++ op ++ "`"
113 where op' = if Help.isOp op then op else "`" ++ op ++ "`"
114+ Lambda p e -> P.text "\\" <> args <+> P.text "->" <+> pretty body
114− Lambda p e -> let (ps,body) = collectLambdas (Location.none $ Lambda p e)
116+ (ps,body) = collectLambdas (Location.none $ Lambda p e)
115− in P.text "\\" <> P.sep ps <+> P.text "->" <+> pretty body
117+ args = P.sep (map Pattern.prettyParens ps)
116 App _ _ -> P.hang func 2 (P.sep args)
118 App _ _ -> P.hang func 2 (P.sep args)
117 where func:args = map prettyParens (collectApps (Location.none expr))
119 where func:args = map prettyParens (collectApps (Location.none expr))
118 MultiIf branches -> P.text "if" $$ nest 3 (vcat $ map iff branches)
120 MultiIf branches -> P.text "if" $$ nest 3 (vcat $ map iff branches)
@@ -179,12 +181,11 @@ collectApps lexpr@(Location.L _ expr) =
179 App a b -> collectApps a ++ [b]
181 App a b -> collectApps a ++ [b]
180 _ -> [lexpr]
182 _ -> [lexpr]
182−collectLambdas :: LExpr' def -> ([Doc], LExpr' def)
184+collectLambdas :: LExpr' def -> ([Pattern.Pattern], LExpr' def)
183collectLambdas lexpr@(Location.L _ expr) =
185collectLambdas lexpr@(Location.L _ expr) =
184 case expr of
186 case expr of
185− Lambda pattern body ->
187+ Lambda pattern body -> (pattern : ps, body')
186− let (ps, body') = collectLambdas body
188+ where (ps, body') = collectLambdas body
187− in (pretty pattern : ps, body')
188 _ -> ([], lexpr)
189 _ -> ([], lexpr)
190prettyParens :: (Pretty def) => LExpr' def -> Doc
191prettyParens :: (Pretty def) => LExpr' def -> Doc