X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Ftypes%2FTyCon.lhs;h=723a7904f88d63cbf8cc1ce1bf7e6d4e799aa3ba;hp=1464fabcc7d3aa7223d99b4ed88546b3267f8b33;hb=d76c18e05f6366c23144624b696a02fbaa6d26e8;hpb=a1899edb87b3192f192980f392680df05f50f104 diff --git a/compiler/types/TyCon.lhs b/compiler/types/TyCon.lhs index 1464fab..723a790 100644 --- a/compiler/types/TyCon.lhs +++ b/compiler/types/TyCon.lhs @@ -19,7 +19,7 @@ module TyCon( isEnumerationTyCon, isGadtSyntaxTyCon, isOpenTyCon, assocTyConArgPoss_maybe, isTyConAssoc, setTyConArgPoss, isTupleTyCon, isUnboxedTupleTyCon, isBoxedTupleTyCon, tupleTyConBoxity, - isRecursiveTyCon, newTyConRep, newTyConRhs, newTyConCo, + isRecursiveTyCon, newTyConRep, newTyConRhs, newTyConCo_maybe, isHiBootTyCon, isSuperKindTyCon, isCoercionTyCon_maybe, isCoercionTyCon, @@ -50,6 +50,7 @@ module TyCon( tyConArity, isClassTyCon, tyConClass_maybe, isFamInstTyCon, tyConFamInst_maybe, tyConFamilyCoercion_maybe, + tyConFamInstIndex, synTyConDefn, synTyConRhs, synTyConType, synTyConResKind, tyConExtName, -- External name for foreign types @@ -274,6 +275,9 @@ data AlgTyConParent = -- An ordinary type constructor has no parent. TyCon -- a *coercion* identifying -- the representation type -- with the type instance + Int -- index to generate unique + -- name (needed here to put + -- into iface) data SynTyConRhs = OpenSynTyCon Kind -- Type family: *result* kind given @@ -756,12 +760,9 @@ newTyConRep :: TyCon -> ([TyVar], Type) newTyConRep (AlgTyCon {tyConTyVars = tvs, algTcRhs = NewTyCon { nt_rep = rep }}) = (tvs, rep) newTyConRep tycon = pprPanic "newTyConRep" (ppr tycon) -newTyConCo :: TyCon -> Maybe TyCon -newTyConCo (AlgTyCon {tyConTyVars = tvs, algTcRhs = NewTyCon { nt_co = co }}) - = co -newTyConCo (AlgTyCon {tyConTyVars = tvs, algTcRhs = OpenNewTyCon}) - = Nothing -newTyConCo tycon = pprPanic "newTyConCo" (ppr tycon) +newTyConCo_maybe :: TyCon -> Maybe TyCon +newTyConCo_maybe (AlgTyCon {algTcRhs = NewTyCon { nt_co = co }}) = co +newTyConCo_maybe _ = Nothing tyConPrimRep :: TyCon -> PrimRep tyConPrimRep (PrimTyCon {primTyConRep = rep}) = rep @@ -816,20 +817,25 @@ tyConClass_maybe (AlgTyCon {algTcParent = ClassTyCon clas}) = Just clas tyConClass_maybe ther_tycon = Nothing isFamInstTyCon :: TyCon -> Bool -isFamInstTyCon (AlgTyCon {algTcParent = FamilyTyCon _ _ _}) = True -isFamInstTyCon other_tycon = False +isFamInstTyCon (AlgTyCon {algTcParent = FamilyTyCon _ _ _ _}) = True +isFamInstTyCon other_tycon = False tyConFamInst_maybe :: TyCon -> Maybe (TyCon, [Type]) -tyConFamInst_maybe (AlgTyCon {algTcParent = FamilyTyCon fam instTys _}) = +tyConFamInst_maybe (AlgTyCon {algTcParent = FamilyTyCon fam instTys _ _}) = Just (fam, instTys) -tyConFamInst_maybe ther_tycon = +tyConFamInst_maybe ther_tycon = Nothing tyConFamilyCoercion_maybe :: TyCon -> Maybe TyCon -tyConFamilyCoercion_maybe (AlgTyCon {algTcParent = FamilyTyCon _ _ coe}) = +tyConFamilyCoercion_maybe (AlgTyCon {algTcParent = FamilyTyCon _ _ coe _}) = Just coe -tyConFamilyCoercion_maybe ther_tycon = +tyConFamilyCoercion_maybe ther_tycon = Nothing + +tyConFamInstIndex :: TyCon -> Int +tyConFamInstIndex (AlgTyCon {algTcParent = FamilyTyCon _ _ _ index}) = index +tyConFamInstIndex _ = + panic "tyConFamInstIndex" \end{code}