[project @ 2003-07-10 08:02:29 by simonpj]
[ghc-hetmet.git] / ghc / compiler / types / PprType.lhs
index 39ae2ee..4a04bff 100644 (file)
@@ -18,22 +18,19 @@ 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:
-import CmdLineOpts     ( opt_PprStyle_RawTypes )
 import Maybes          ( maybeToBool )
 import Name            ( getOccString, getOccName )
 import OccName         ( occNameUserString )
@@ -87,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}
 
 
@@ -134,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
@@ -221,7 +221,7 @@ and when in debug mode.
 pprTyVarBndr :: TyVar -> SDoc
 pprTyVarBndr tyvar
   = getPprStyle $ \ sty ->
-    if (ifaceStyle sty  && not (kind `eqKind` liftedTypeKind)) || debugStyle sty then
+    if debugStyle sty then
         hsep [ppr tyvar, dcolon, pprParendKind kind]
                -- See comments with ppDcolon in PprCore.lhs
     else