X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Ftypes%2FTyCon.lhs;h=d91effeada8da392126742bd68afd40d621c53e5;hp=f03fb8952ef8a7626f51695871e0b28cab11a53a;hb=b00b5bc04ff36a551552470060064f0b7d84ca30;hpb=7e623a3a6c4fa75bae5be29a9fca015f98f1c30b diff --git a/compiler/types/TyCon.lhs b/compiler/types/TyCon.lhs index f03fb89..d91effe 100644 --- a/compiler/types/TyCon.lhs +++ b/compiler/types/TyCon.lhs @@ -10,7 +10,8 @@ module TyCon( PrimRep(..), tyConPrimRep, - AlgTyConRhs(..), visibleDataCons, AlgTyConParent(..), + AlgTyConRhs(..), visibleDataCons, + AlgTyConParent(..), hasParent, SynTyConRhs(..), isFunTyCon, isUnLiftedTyCon, isProductTyCon, @@ -22,6 +23,7 @@ module TyCon( isRecursiveTyCon, newTyConRep, newTyConRhs, newTyConCo_maybe, isHiBootTyCon, isSuperKindTyCon, isCoercionTyCon_maybe, isCoercionTyCon, + isImplicitTyCon, tcExpandTyCon_maybe, coreExpandTyCon_maybe, @@ -275,6 +277,10 @@ data AlgTyConParent = -- An ordinary type constructor has no parent. -- the representation type -- with the type instance +hasParent :: AlgTyConParent -> Bool +hasParent NoParentTyCon = False +hasParent _other = True + data SynTyConRhs = OpenSynTyCon Kind -- Type family: *result* kind given | SynonymTyCon Type -- Mentioning head type vars. Acts as a template for @@ -662,8 +668,16 @@ isCoercionTyCon_maybe (CoercionTyCon {tyConArity = ar, coKindFun = rule}) = Just (ar, rule) isCoercionTyCon_maybe other = Nothing +isCoercionTyCon :: TyCon -> Bool isCoercionTyCon (CoercionTyCon {}) = True isCoercionTyCon other = False + +isImplicitTyCon :: TyCon -> Bool +isImplicitTyCon SynTyCon{} = False +isImplicitTyCon AlgTyCon{algTcParent = parent} = hasParent parent +isImplicitTyCon other = True + -- catches: FunTyCon, TupleTyCon, PrimTyCon, + -- CoercionTyCon, SuperKindTyCon \end{code}