-pprCoreBinding :: PprStyle -> CoreBinding -> Pretty
-
-pprGenCoreBinding
- :: (Eq tyvar, Outputable tyvar,
- Eq uvar, Outputable uvar,
- Outputable bndr,
- Outputable occ)
- => PprStyle
- -> (bndr -> Pretty) -- to print "major" val_bdrs
- -> (bndr -> Pretty) -- to print "minor" val_bdrs
- -> (occ -> Pretty) -- to print bindees
- -> GenCoreBinding bndr occ tyvar uvar
- -> Pretty
-
-pprGenCoreBinding sty pbdr1 pbdr2 pocc bind
- = ppr_bind (init_ppr_env sty (ppr sty) pbdr1 pbdr2 pocc) bind
-
-init_ppr_env sty tvbndr pbdr1 pbdr2 pocc
- = initPprEnv sty
- (Just (ppr sty)) -- literals
- (Just ppr_con) -- data cons
- (Just ppr_prim) -- primops
- (Just (\ cc -> ppStr (showCostCentre sty True cc)))
- (Just tvbndr) -- tyvar binders
- (Just (ppr sty)) -- tyvar occs
- (Just (ppr sty)) -- usage vars
- (Just pbdr1) (Just pbdr2) (Just pocc) -- value vars
- (Just (pprParendGenType sty)) -- types
- (Just (ppr sty)) -- usages
- where
-
- ppr_con con = ppr sty con
-
-{- [We now use Con {a,b,c} for Con expressions. SLPJ March 97.]
- [We can't treat them as ordinary applications because the Con doesn't have
- dictionaries in it, whereas the constructor Id does.]
-
- OLD VERSION:
- -- ppr_con is used when printing Con expressions; we add a "!"
- -- to distinguish them from ordinary applications. But not when
- -- printing for interfaces, where they are treated as ordinary applications
- ppr_con con | ifaceStyle sty = ppr sty con
- | otherwise = ppr sty con `ppBeside` ppChar '!'
--}
-
- -- We add a "!" to distinguish Primitive applications from ordinary applications.
- -- But not when printing for interfaces, where they are treated
- -- as ordinary applications
- ppr_prim prim | ifaceStyle sty = ppr sty prim
- | otherwise = ppr sty prim `ppBeside` ppChar '!'
-
---------------
-pprCoreBinding sty (NonRec binder expr)
- = ppHang (ppCat [pprBigCoreBinder sty binder, ppEquals])
- 4 (pprCoreExpr sty (pprBigCoreBinder sty) (pprBabyCoreBinder sty) (ppr sty) expr)
-
-pprCoreBinding sty (Rec binds)
- = ppAboves [ifPprDebug sty (ppPStr SLIT("{- plain Rec -}")),
- ppAboves (map ppr_bind binds),
- ifPprDebug sty (ppPStr SLIT("{- end plain Rec -}"))]
- where
- ppr_bind (binder, expr)
- = ppHang (ppCat [pprBigCoreBinder sty binder, ppEquals])
- 4 (pprCoreExpr sty (pprBigCoreBinder sty) (pprBabyCoreBinder sty) (ppr sty) expr)
+pprCoreBindings :: [CoreBind] -> SDoc
+pprCoreBinding :: CoreBind -> SDoc
+pprCoreExpr :: CoreExpr -> SDoc
+pprParendExpr :: CoreExpr -> SDoc
+
+pprCoreBindings = pprTopBinds pprCoreEnv
+pprCoreBinding = pprTopBind pprCoreEnv
+pprCoreExpr = ppr_noparend_expr pprCoreEnv
+pprParendExpr = ppr_parend_expr pprCoreEnv
+pprArg = ppr_arg pprCoreEnv
+pprCoreAlt = ppr_alt pprCoreEnv
+
+pprCoreEnv = initCoreEnv pprCoreBinder