X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FcoreSyn%2FPprCore.lhs;h=d641a9e833140f8e900d69f31057e50c4c81a835;hp=39d5b354f657b636a1877563fa5f53abc97ba0c8;hb=7e8cba32c6f045dde3db8a9ddc9831ec8ab4ed43;hpb=bb924bddcd3988d50b4cf2afbd8895e886a23520 diff --git a/compiler/coreSyn/PprCore.lhs b/compiler/coreSyn/PprCore.lhs index 39d5b35..d641a9e 100644 --- a/compiler/coreSyn/PprCore.lhs +++ b/compiler/coreSyn/PprCore.lhs @@ -248,7 +248,7 @@ instance OutputableBndr Var where pprCoreBinder :: BindingSite -> Var -> SDoc pprCoreBinder LetBind binder - | isTyVar binder = pprTypedBinder binder + | isTyVar binder = pprKindedTyVarBndr binder | otherwise = vcat [sig, pprIdDetails binder, pragmas] where @@ -256,7 +256,15 @@ pprCoreBinder LetBind binder pragmas = ppIdInfo binder (idInfo binder) -- Lambda bound type variables are preceded by "@" -pprCoreBinder LambdaBind bndr = parens (pprTypedBinder bndr) +pprCoreBinder LambdaBind bndr + | isDeadBinder bndr + = getPprStyle $ \ sty -> + if debugStyle sty then + parens (pprTypedBinder bndr) + else + char '_' + | otherwise + = parens (pprTypedBinder bndr) -- Case bound things don't get a signature or a herald, unless we have debug on pprCoreBinder CaseBind bndr @@ -264,7 +272,8 @@ pprCoreBinder CaseBind bndr if debugStyle sty then parens (pprTypedBinder bndr) else - pprUntypedBinder bndr + if isDeadBinder bndr then char '_' + else pprUntypedBinder bndr pprUntypedBinder :: Var -> SDoc pprUntypedBinder binder @@ -272,19 +281,19 @@ pprUntypedBinder binder | otherwise = pprIdBndr binder pprTypedBinder :: Var -> SDoc +-- Print binder with a type or kind signature (not paren'd) pprTypedBinder binder - | isTyVar binder = ptext (sLit "@") <+> pprTyVarBndr binder + | isTyVar binder = pprKindedTyVarBndr binder | otherwise = pprIdBndr binder <+> dcolon <+> pprType (idType binder) -pprTyVarBndr :: TyVar -> SDoc -pprTyVarBndr tyvar - = getPprStyle $ \ sty -> - if debugStyle sty then - hsep [ppr tyvar, dcolon, pprParendKind kind] - -- See comments with ppDcolon in PprCore.lhs - else - ppr tyvar +pprKindedTyVarBndr :: TyVar -> SDoc +-- Print a type variable binder with its kind (but not if *) +pprKindedTyVarBndr tyvar + = ptext (sLit "@") <+> ppr tyvar <> opt_kind where + opt_kind -- Print the kind if not * + | isLiftedTypeKind kind = empty + | otherwise = dcolon <> pprKind kind kind = tyVarKind tyvar -- pprIdBndr does *not* print the type