-- 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 )
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}
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
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