[project @ 2003-07-31 10:07:02 by simonmar]
[ghc-hetmet.git] / ghc / compiler / types / PprType.lhs
index c8edc3e..4a04bff 100644 (file)
@@ -18,18 +18,16 @@ module PprType(
 
 -- friends:
 -- (PprType can see all the representations it's trying to print)
-import TypeRep         ( Type(..), TyNote(..), 
-                         Kind, liftedTypeKind ) -- friend
-import Type            ( SourceType(..), eqKind )
-import TcType          ( ThetaType, PredType,
+import TypeRep         ( Type(..), TyNote(..), Kind  ) -- friend
+import Type            ( SourceType(..) ) 
+import TcType          ( ThetaType, PredType, TyThing(..),
                          tcSplitSigmaTy, isPredTy, isDictTy,
                          tcSplitTyConApp_maybe, tcSplitFunTy_maybe
                        ) 
 import Var             ( TyVar, tyVarKind )
 import Class           ( Class )
 import TyCon           ( TyCon, isPrimTyCon, isTupleTyCon, tupleTyConBoxity,
-                         maybeTyConSingleCon, isEnumerationTyCon, 
-                         tyConArity, tyConName
+                         maybeTyConSingleCon, isEnumerationTyCon, tyConArity
                        )
 
 -- others:
@@ -86,6 +84,15 @@ instance Outputable SourceType where
 instance Outputable name => Outputable (IPName name) where
     ppr (Dupable n) = char '?' <> ppr n -- Ordinary implicit parameters
     ppr (Linear  n) = char '%' <> ppr n -- Splittable implicit parameters
+
+instance Outputable name => OutputableBndr (IPName name) where
+    pprBndr _ n = ppr n        -- Simple for now
+
+instance Outputable TyThing where
+  ppr (AnId   id)   = ptext SLIT("AnId")     <+> ppr id
+  ppr (ATyCon tc)   = ptext SLIT("ATyCon")   <+> ppr tc
+  ppr (AClass cl)   = ptext SLIT("AClass")   <+> ppr cl
+  ppr (ADataCon dc) = ptext SLIT("ADataCon") <+> ppr dc
 \end{code}
 
 
@@ -133,12 +140,6 @@ ppr_ty ctxt_prec ty@(TyConApp tycon tys)
        other          -> maybeParen ctxt_prec tYCON_PREC 
                                     (ppr tycon <+> ppr_ty tYCON_PREC ty)
 
-       -- USAGE CASE
-  | (tycon `hasKey` usOnceTyConKey || tycon `hasKey` usManyTyConKey),
-    null tys
-  =    -- For usages (! and .), always print bare OccName, without pkg/mod/uniq
-    ppr (getOccName (tyConName tycon))
-       
        -- TUPLE CASE (boxed and unboxed)
   |  isTupleTyCon tycon,
       tys `lengthIs` tyConArity tycon  -- No magic if partially applied