-ppr_uf_Expr in_scopes expr@(App fun_expr atom)
- = let
- (fun, args) = collect_args expr []
- in
- ppCat [ppPStr SLIT("_APP_ "), ppr_uf_Expr in_scopes fun, ppLbrack,
- ppIntersperse pp'SP{-'-} (map (ppr_uf_Atom in_scopes) args), ppRbrack]
- where
- collect_args (App fun arg) args = collect_args fun (arg:args)
- collect_args fun args = (fun, args)
-
-ppr_uf_Expr in_scopes (CoTyApp expr ty)
- = ppCat [ppPStr SLIT("_TYAPP_ "), ppr_uf_Expr in_scopes expr,
- ppChar '{', pprParendUniType ppr_Unfolding ty, ppChar '}']
-
-ppr_uf_Expr in_scopes (Case scrutinee alts)
- = ppCat [ppPStr SLIT("case"), ppr_uf_Expr in_scopes scrutinee, ppStr "of {",
- pp_alts alts, ppChar '}']
- where
- pp_alts (AlgAlts alts deflt)
- = ppCat [ppPStr SLIT("_ALG_"), ppCat (map pp_alg alts), pp_deflt deflt]
- pp_alts (PrimAlts alts deflt)
- = ppCat [ppPStr SLIT("_PRIM_"), ppCat (map pp_prim alts), pp_deflt deflt]
-
- pp_alg (con, params, rhs)
- = ppBesides [pprIdInUnfolding no_in_scopes con, ppSP,
- ppIntersperse ppSP (map ppr_uf_Binder params),
- ppPStr SLIT(" -> "), ppr_uf_Expr (in_scopes `add_some` params) rhs, ppSemi]
-
- pp_prim (lit, rhs)
- = ppBesides [ppr ppr_Unfolding lit,
- ppPStr SLIT(" -> "), ppr_uf_Expr in_scopes rhs, ppSemi]
-
- pp_deflt NoDefault = ppPStr SLIT("_NO_DEFLT_")
- pp_deflt (BindDefault binder rhs)
- = ppBesides [ppr_uf_Binder binder, ppPStr SLIT(" -> "),
- ppr_uf_Expr (in_scopes `add1` binder) rhs]
-
-ppr_uf_Expr in_scopes (Let (NonRec binder rhs) body)
- = ppBesides [ppStr "let {", ppr_uf_Binder binder, ppPStr SLIT(" = "), ppr_uf_Expr in_scopes rhs,
- ppStr "} in ", ppr_uf_Expr (in_scopes `add1` binder) body]
-
-ppr_uf_Expr in_scopes (Let (Rec pairs) body)
- = ppBesides [ppStr "_LETREC_ {", ppIntersperse sep (map pp_pair pairs),
- ppStr "} in ", ppr_uf_Expr new_in_scopes body]
- where
- sep = ppBeside ppSemi ppSP
- new_in_scopes = in_scopes `add_some` map fst pairs
-
- pp_pair (b, rhs) = ppCat [ppr_uf_Binder b, ppEquals, ppr_uf_Expr new_in_scopes rhs]
-
-ppr_uf_Expr in_scopes (SCC cc body)
- = ASSERT(not (noCostCentreAttached cc))
- ASSERT(not (currentOrSubsumedCosts cc))
- ppBesides [ppStr "_scc_ { ", ppStr (showCostCentre ppr_Unfolding False{-not as string-} cc), ppStr " } ", ppr_uf_Expr in_scopes body]
-\end{code}