X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fiface%2FIfaceType.lhs;h=47772d7c461484bf0fda0511a9b58b8fbe1f2196;hb=7ec78f77f4d591a2ab0090769920fd4773641c33;hp=2db1908713dea857478775093a56f8a8eaf7de59;hpb=388e3356f71daffa62f1d4157e1e07e4c68f218a;p=ghc-hetmet.git diff --git a/compiler/iface/IfaceType.lhs b/compiler/iface/IfaceType.lhs index 2db1908..47772d7 100644 --- a/compiler/iface/IfaceType.lhs +++ b/compiler/iface/IfaceType.lhs @@ -73,7 +73,8 @@ data IfaceTyCon -- Abbreviations for common tycons with known names | IfaceIntTc | IfaceBoolTc | IfaceCharTc | IfaceListTc | IfacePArrTc | IfaceTupTc Boxity Arity - | IfaceAnyTc IfaceKind -- Used for AnyTyCon (see Note [Any Types] in TysPrim) + | IfaceAnyTc IfaceKind -- Used for AnyTyCon (see Note [Any Types] in TysPrim) + -- other than 'Any :: *' itself | IfaceLiftedTypeKindTc | IfaceOpenTypeKindTc | IfaceUnliftedTypeKindTc | IfaceUbxTupleKindTc | IfaceArgTypeKindTc @@ -90,15 +91,16 @@ ifaceTyConName IfaceUnliftedTypeKindTc = unliftedTypeKindTyConName ifaceTyConName IfaceUbxTupleKindTc = ubxTupleKindTyConName ifaceTyConName IfaceArgTypeKindTc = argTypeKindTyConName ifaceTyConName (IfaceTc ext) = ext -ifaceTyConName (IfaceAnyTc kind) = pprPanic "ifaceTyConName" (ppr (IfaceAnyTc kind)) +ifaceTyConName (IfaceAnyTc k) = pprPanic "ifaceTyConName" (ppr k) -- Note [The Name of an IfaceAnyTc] \end{code} Note [The Name of an IfaceAnyTc] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It isn't easy to get the Name of an IfaceAnyTc in a pure way. What you really need to do is to transform it to a TyCon, and get the Name of that. -But doing so needs the monad. +But doing so needs the monad because there's an IfaceKind inside, and we +need a Kind. In fact, ifaceTyConName is only used for instances and rules, and we don't expect to instantiate those at these (internal-ish) Any types, so rather @@ -253,14 +255,17 @@ instance Outputable IfacePredType where <+> sep (map pprParendIfaceType ts) instance Outputable IfaceTyCon where - ppr (IfaceTc ext) = ppr ext - ppr other_tc = ppr (ifaceTyConName other_tc) + ppr (IfaceAnyTc k) = ptext (sLit "Any") <> pprParendIfaceType k + -- We can't easily get the Name of an IfaceAnyTc + -- (see Note [The Name of an IfaceAnyTc]) + -- so we fake it. It's only for debug printing! + ppr other_tc = ppr (ifaceTyConName other_tc) ------------------- pprIfaceContext :: IfaceContext -> SDoc -- Prints "(C a, D b) =>", including the arrow pprIfaceContext [] = empty -pprIfaceContext theta = ppr_preds theta <+> ptext (sLit "=>") +pprIfaceContext theta = ppr_preds theta <+> darrow ppr_preds :: [IfacePredType] -> SDoc ppr_preds [pred] = ppr pred -- No parens