[project @ 2005-05-05 12:39:19 by simonpj]
[ghc-hetmet.git] / ghc / compiler / iface / IfaceType.lhs
index f893a58..e13f77b 100644 (file)
@@ -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