X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fiface%2FIfaceType.lhs;h=e13f77b7636dca737c69f8fdab37187e2aa1f244;hb=65a95d52d7ad2a911f7c8d18b34f0b71002d448f;hp=f893a58f377e12817085c018f444817e253e39d3;hpb=a84285247bfb162fdefc3fcb8be88c34c1f5cd35;p=ghc-hetmet.git diff --git a/ghc/compiler/iface/IfaceType.lhs b/ghc/compiler/iface/IfaceType.lhs index f893a58..e13f77b 100644 --- a/ghc/compiler/iface/IfaceType.lhs +++ b/ghc/compiler/iface/IfaceType.lhs @@ -14,7 +14,7 @@ module IfaceType ( -- Conversion from Type -> IfaceType toIfaceType, toIfacePred, toIfaceContext, - toIfaceBndr, toIfaceIdBndr, toIfaceTvBndrs, + toIfaceBndr, toIfaceIdBndr, toIfaceTvBndrs, toIfaceTyCon, -- Printing pprIfaceType, pprParendIfaceType, pprIfaceContext, @@ -307,10 +307,13 @@ instance Outputable IfaceTyCon where ------------------- pprIfaceContext :: IfaceContext -> SDoc -- Prints "(C a, D b) =>", including the arrow -pprIfaceContext [] = empty -pprIfaceContext theta = parens (sep (punctuate comma (map ppr theta))) - <+> ptext SLIT("=>") - +pprIfaceContext [] = empty +pprIfaceContext theta = ppr_preds theta <+> ptext SLIT("=>") + +ppr_preds [pred] = ppr pred -- No parens +ppr_preds preds = parens (sep (punctuate comma (map ppr preds))) + +------------------- pabrackets p = ptext SLIT("[:") <> p <> ptext SLIT(":]") \end{code} @@ -335,15 +338,15 @@ toIfaceType :: (Name -> IfaceExtName) -> Type -> IfaceType toIfaceType ext (TyVarTy tv) = IfaceTyVar (getOccName tv) toIfaceType ext (AppTy t1 t2) = IfaceAppTy (toIfaceType ext t1) (toIfaceType ext t2) toIfaceType ext (FunTy t1 t2) = IfaceFunTy (toIfaceType ext t1) (toIfaceType ext t2) -toIfaceType ext (TyConApp tc tys) = IfaceTyConApp (mkIfaceTc ext tc) (toIfaceTypes ext tys) +toIfaceType ext (TyConApp tc tys) = IfaceTyConApp (toIfaceTyCon ext tc) (toIfaceTypes ext tys) toIfaceType ext (ForAllTy tv t) = IfaceForAllTy (toIfaceTvBndr tv) (toIfaceType ext t) toIfaceType ext (PredTy st) = IfacePredTy (toIfacePred ext st) toIfaceType ext (NoteTy (SynNote tc_app) ty) = toIfaceType ext tc_app -- Retain synonyms toIfaceType ext (NoteTy other_note ty) = toIfaceType ext ty ---------------- -mkIfaceTc :: (Name -> IfaceExtName) -> TyCon -> IfaceTyCon -mkIfaceTc ext tc +toIfaceTyCon :: (Name -> IfaceExtName) -> TyCon -> IfaceTyCon +toIfaceTyCon ext tc | isTupleTyCon tc = IfaceTupTc (tupleTyConBoxity tc) (tyConArity tc) | nm == intTyConName = IfaceIntTc | nm == boolTyConName = IfaceBoolTc