X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FhsSyn%2FHsExpr.lhs;h=86c41906bf3cc339d4d3243245a1f578ade9eeab;hb=0a1d263163f12502405b191895fffe48e47b2dfc;hp=de3ae9e8ddfca9f03b207a442f8e7ba481570d58;hpb=43c2b68138397eb08aa386e2818b6cc17e94fd1e;p=ghc-hetmet.git diff --git a/ghc/compiler/hsSyn/HsExpr.lhs b/ghc/compiler/hsSyn/HsExpr.lhs index de3ae9e..86c4190 100644 --- a/ghc/compiler/hsSyn/HsExpr.lhs +++ b/ghc/compiler/hsSyn/HsExpr.lhs @@ -14,7 +14,7 @@ import HsPat ( LPat ) import HsLit ( HsLit(..), HsOverLit ) import HsTypes ( LHsType, PostTcType ) import HsImpExp ( isOperator, pprHsVar ) -import HsBinds ( HsBindGroup, DictBinds ) +import HsBinds ( HsLocalBinds, DictBinds, isEmptyLocalBinds ) -- others: import Type ( Type, pprParendType ) @@ -121,7 +121,7 @@ data HsExpr id (LHsExpr id) -- then part (LHsExpr id) -- else part - | HsLet [HsBindGroup id] -- let(rec) + | HsLet (HsLocalBinds id) -- let(rec) (LHsExpr id) | HsDo (HsStmtContext Name) -- The parameterisation is unimportant @@ -274,8 +274,8 @@ pprExpr :: OutputableBndr id => HsExpr id -> SDoc pprExpr e = pprDeeper (ppr_expr e) -pprBinds :: OutputableBndr id => [HsBindGroup id] -> SDoc -pprBinds b = pprDeeper (vcat (map ppr b)) +pprBinds :: OutputableBndr id => HsLocalBinds id -> SDoc +pprBinds b = pprDeeper (ppr b) ppr_lexpr :: OutputableBndr id => LHsExpr id -> SDoc ppr_lexpr e = ppr_expr (unLoc e) @@ -319,7 +319,7 @@ ppr_expr (SectionL expr op) pp_prefixly = hang (hsep [text " \\ x_ ->", ppr op]) 4 (hsep [pp_expr, ptext SLIT("x_ )")]) - pp_infixly v = parens (sep [pp_expr, ppr v]) + pp_infixly v = parens (sep [pp_expr, pprInfix v]) ppr_expr (SectionR op expr) = case unLoc op of @@ -331,7 +331,7 @@ ppr_expr (SectionR op expr) pp_prefixly = hang (hsep [text "( \\ x_ ->", ppr op, ptext SLIT("x_")]) 4 ((<>) pp_expr rparen) pp_infixly v - = parens (sep [ppr v, pp_expr]) + = parens (sep [pprInfix v, pp_expr]) ppr_expr (HsLam matches) = pprMatches LambdaExpr matches @@ -528,7 +528,7 @@ The legal constructors for commands are: (HsCmd id) -- else part SrcLoc - | HsLet (HsBinds id) -- let(rec) + | HsLet (HsLocalBinds id) -- let(rec) (HsCmd id) | HsDo (HsStmtContext Name) -- The parameterisation is unimportant @@ -619,7 +619,7 @@ hsLMatchPats (L _ (Match pats _ _)) = pats -- GRHSs are used both for pattern bindings and for Matches data GRHSs id = GRHSs [LGRHS id] -- Guarded RHSs - [HsBindGroup id] -- The where clause + (HsLocalBinds id) -- The where clause type LGRHS id = Located (GRHS id) @@ -663,7 +663,7 @@ pprGRHSs :: OutputableBndr id => HsMatchContext id -> GRHSs id -> SDoc pprGRHSs ctxt (GRHSs grhss binds) = vcat (map (pprGRHS ctxt . unLoc) grhss) $$ - (if null binds then empty + (if isEmptyLocalBinds binds then empty else text "where" $$ nest 4 (pprBinds binds)) pprGRHS :: OutputableBndr id => HsMatchContext id -> GRHS id -> SDoc @@ -700,10 +700,10 @@ data Stmt id (SyntaxExpr id) -- The (>>) operator PostTcType -- Element type of the RHS (used for arrows) - | LetStmt [HsBindGroup id] + | LetStmt (HsLocalBinds id) -- ParStmts only occur in a list comprehension - | ParStmt [([LStmt id], [id])] -- After remaing, the ids are the binders + | ParStmt [([LStmt id], [id])] -- After renaming, the ids are the binders -- bound by the stmts and used subsequently -- Recursive statement (see Note [RecStmt] below)