| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
GHC.Core.TyCon
Synopsis
- data TyCon
- data AlgTyConRhs
- = AbstractTyCon
- | DataTyCon { }
- | TupleTyCon { }
- | SumTyCon {
- data_cons :: [DataCon]
- data_cons_size :: Int
- | NewTyCon {
- data_con :: DataCon
- nt_rhs :: Type
- nt_etad_rhs :: ([TyVar], Type)
- nt_co :: CoAxiom Unbranched
- nt_lev_poly :: Bool
- visibleDataCons :: AlgTyConRhs -> [DataCon]
- data AlgTyConFlav
- isNoParent :: AlgTyConFlav -> Bool
- data FamTyConFlav
- data Role
- data Injectivity
- = NotInjective
- | Injective [Bool]
- data RuntimeRepInfo
- = NoRRI
- | RuntimeRep ([Type] -> [PrimRep])
- | VecCount Int
- | VecElem PrimElemRep
- data TyConFlavour
- type TyConBinder = VarBndr TyVar TyConBndrVis
- data TyConBndrVis
- type TyConTyCoBinder = VarBndr TyCoVar TyConBndrVis
- mkNamedTyConBinder :: ArgFlag -> TyVar -> TyConBinder
- mkNamedTyConBinders :: ArgFlag -> [TyVar] -> [TyConBinder]
- mkRequiredTyConBinder :: TyCoVarSet -> TyVar -> TyConBinder
- mkAnonTyConBinder :: AnonArgFlag -> TyVar -> TyConBinder
- mkAnonTyConBinders :: AnonArgFlag -> [TyVar] -> [TyConBinder]
- tyConBinderArgFlag :: TyConBinder -> ArgFlag
- tyConBndrVisArgFlag :: TyConBndrVis -> ArgFlag
- isNamedTyConBinder :: TyConBinder -> Bool
- isVisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool
- isInvisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool
- tyConFieldLabels :: TyCon -> [FieldLabel]
- lookupTyConFieldLabel :: FieldLabelString -> TyCon -> Maybe FieldLabel
- mkAlgTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Maybe CType -> [PredType] -> AlgTyConRhs -> AlgTyConFlav -> Bool -> TyCon
- mkClassTyCon :: Name -> [TyConBinder] -> [Role] -> AlgTyConRhs -> Class -> Name -> TyCon
- mkFunTyCon :: Name -> [TyConBinder] -> Name -> TyCon
- mkPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon
- mkKindTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Name -> TyCon
- mkLiftedPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon
- mkTupleTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> DataCon -> TupleSort -> AlgTyConFlav -> TyCon
- mkSumTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> [TyVar] -> [DataCon] -> AlgTyConFlav -> TyCon
- mkDataTyConRhs :: [DataCon] -> AlgTyConRhs
- mkSynonymTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Type -> Bool -> Bool -> TyCon
- mkFamilyTyCon :: Name -> [TyConBinder] -> Kind -> Maybe Name -> FamTyConFlav -> Maybe Class -> Injectivity -> TyCon
- mkPromotedDataCon :: DataCon -> Name -> TyConRepName -> [TyConTyCoBinder] -> Kind -> [Role] -> RuntimeRepInfo -> TyCon
- mkTcTyCon :: Name -> [TyConBinder] -> Kind -> [(Name, TcTyVar)] -> Bool -> TyConFlavour -> TyCon
- noTcTyConScopedTyVars :: [(Name, TcTyVar)]
- isAlgTyCon :: TyCon -> Bool
- isVanillaAlgTyCon :: TyCon -> Bool
- isConstraintKindCon :: TyCon -> Bool
- isClassTyCon :: TyCon -> Bool
- isFamInstTyCon :: TyCon -> Bool
- isFunTyCon :: TyCon -> Bool
- isPrimTyCon :: TyCon -> Bool
- isTupleTyCon :: TyCon -> Bool
- isUnboxedTupleTyCon :: TyCon -> Bool
- isBoxedTupleTyCon :: TyCon -> Bool
- isUnboxedSumTyCon :: TyCon -> Bool
- isPromotedTupleTyCon :: TyCon -> Bool
- isTypeSynonymTyCon :: TyCon -> Bool
- mustBeSaturated :: TyCon -> Bool
- isPromotedDataCon :: TyCon -> Bool
- isPromotedDataCon_maybe :: TyCon -> Maybe DataCon
- isKindTyCon :: TyCon -> Bool
- isLiftedTypeKindTyConName :: Name -> Bool
- isTauTyCon :: TyCon -> Bool
- isFamFreeTyCon :: TyCon -> Bool
- isDataTyCon :: TyCon -> Bool
- isProductTyCon :: TyCon -> Bool
- isDataProductTyCon_maybe :: TyCon -> Maybe DataCon
- isDataSumTyCon_maybe :: TyCon -> Maybe [DataCon]
- isEnumerationTyCon :: TyCon -> Bool
- isNewTyCon :: TyCon -> Bool
- isAbstractTyCon :: TyCon -> Bool
- isFamilyTyCon :: TyCon -> Bool
- isOpenFamilyTyCon :: TyCon -> Bool
- isTypeFamilyTyCon :: TyCon -> Bool
- isDataFamilyTyCon :: TyCon -> Bool
- isOpenTypeFamilyTyCon :: TyCon -> Bool
- isClosedSynFamilyTyConWithAxiom_maybe :: TyCon -> Maybe (CoAxiom Branched)
- tyConInjectivityInfo :: TyCon -> Injectivity
- isBuiltInSynFamTyCon_maybe :: TyCon -> Maybe BuiltInSynFamily
- isUnliftedTyCon :: TyCon -> Bool
- isGadtSyntaxTyCon :: TyCon -> Bool
- isInjectiveTyCon :: TyCon -> Role -> Bool
- isGenerativeTyCon :: TyCon -> Role -> Bool
- isGenInjAlgRhs :: AlgTyConRhs -> Bool
- isTyConAssoc :: TyCon -> Bool
- tyConAssoc_maybe :: TyCon -> Maybe TyCon
- tyConFlavourAssoc_maybe :: TyConFlavour -> Maybe TyCon
- isImplicitTyCon :: TyCon -> Bool
- isTyConWithSrcDataCons :: TyCon -> Bool
- isTcTyCon :: TyCon -> Bool
- setTcTyConKind :: TyCon -> Kind -> TyCon
- isTcLevPoly :: TyCon -> Bool
- tyConName :: TyCon -> Name
- tyConSkolem :: TyCon -> Bool
- tyConKind :: TyCon -> Kind
- tyConUnique :: TyCon -> Unique
- tyConTyVars :: TyCon -> [TyVar]
- tyConVisibleTyVars :: TyCon -> [TyVar]
- tyConCType :: TyCon -> Maybe CType
- tyConCType_maybe :: TyCon -> Maybe CType
- tyConDataCons :: TyCon -> [DataCon]
- tyConDataCons_maybe :: TyCon -> Maybe [DataCon]
- tyConSingleDataCon_maybe :: TyCon -> Maybe DataCon
- tyConSingleDataCon :: TyCon -> DataCon
- tyConSingleAlgDataCon_maybe :: TyCon -> Maybe DataCon
- tyConFamilySize :: TyCon -> Int
- tyConStupidTheta :: TyCon -> [PredType]
- tyConArity :: TyCon -> Arity
- tyConRoles :: TyCon -> [Role]
- tyConFlavour :: TyCon -> TyConFlavour
- tyConTuple_maybe :: TyCon -> Maybe TupleSort
- tyConClass_maybe :: TyCon -> Maybe Class
- tyConATs :: TyCon -> [TyCon]
- tyConFamInst_maybe :: TyCon -> Maybe (TyCon, [Type])
- tyConFamInstSig_maybe :: TyCon -> Maybe (TyCon, [Type], CoAxiom Unbranched)
- tyConFamilyCoercion_maybe :: TyCon -> Maybe (CoAxiom Unbranched)
- tyConFamilyResVar_maybe :: TyCon -> Maybe Name
- synTyConDefn_maybe :: TyCon -> Maybe ([TyVar], Type)
- synTyConRhs_maybe :: TyCon -> Maybe Type
- famTyConFlav_maybe :: TyCon -> Maybe FamTyConFlav
- famTcResVar :: TyCon -> Maybe Name
- algTyConRhs :: TyCon -> AlgTyConRhs
- newTyConRhs :: TyCon -> ([TyVar], Type)
- newTyConEtadArity :: TyCon -> Int
- newTyConEtadRhs :: TyCon -> ([TyVar], Type)
- unwrapNewTyCon_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched)
- unwrapNewTyConEtad_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched)
- newTyConDataCon_maybe :: TyCon -> Maybe DataCon
- algTcFields :: TyCon -> FieldLabelEnv
- tyConRuntimeRepInfo :: TyCon -> RuntimeRepInfo
- tyConBinders :: TyCon -> [TyConBinder]
- tyConResKind :: TyCon -> Kind
- tyConInvisTVBinders :: [TyConBinder] -> [InvisTVBinder]
- tcTyConScopedTyVars :: TyCon -> [(Name, TyVar)]
- tcTyConIsPoly :: TyCon -> Bool
- mkTyConTagMap :: TyCon -> NameEnv ConTag
- expandSynTyCon_maybe :: TyCon -> [tyco] -> Maybe ([(TyVar, tyco)], Type, [tyco])
- newTyConCo :: TyCon -> CoAxiom Unbranched
- newTyConCo_maybe :: TyCon -> Maybe (CoAxiom Unbranched)
- pprPromotionQuote :: TyCon -> SDoc
- mkTyConKind :: [TyConBinder] -> Kind -> Kind
- tcFlavourIsOpen :: TyConFlavour -> Bool
- type TyConRepName = Name
- tyConRepName_maybe :: TyCon -> Maybe TyConRepName
- mkPrelTyConRepName :: Name -> TyConRepName
- tyConRepModOcc :: Module -> OccName -> (Module, OccName)
- data PrimRep
- data PrimElemRep
- isVoidRep :: PrimRep -> Bool
- isGcPtrRep :: PrimRep -> Bool
- primRepSizeB :: Platform -> PrimRep -> Int
- primElemRepSizeB :: PrimElemRep -> Int
- primRepIsFloat :: PrimRep -> Maybe Bool
- primRepsCompatible :: Platform -> [PrimRep] -> [PrimRep] -> Bool
- primRepCompatible :: Platform -> PrimRep -> PrimRep -> Bool
- data RecTcChecker
- initRecTc :: RecTcChecker
- defaultRecTcMaxBound :: Int
- setRecTcMaxBound :: Int -> RecTcChecker -> RecTcChecker
- checkRecTc :: RecTcChecker -> TyCon -> Maybe RecTcChecker
Main TyCon data types
TyCons represent type constructors. Type constructors are introduced by things such as:
1) Data declarations: data Foo = ... creates the Foo type constructor of
kind *
2) Type synonyms: type Foo = ... creates the Foo type constructor
3) Newtypes: newtype Foo a = MkFoo ... creates the Foo type constructor
of kind * -> *
4) Class declarations: class Foo where creates the Foo type constructor
of kind *
This data type also encodes a number of primitive, built in type constructors such as those for function and tuple types.
Instances
| Data TyCon # | |
Defined in GHC.Core.TyCon Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TyCon -> c TyCon Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TyCon Source # toConstr :: TyCon -> Constr Source # dataTypeOf :: TyCon -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TyCon) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TyCon) Source # gmapT :: (forall b. Data b => b -> b) -> TyCon -> TyCon Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TyCon -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TyCon -> r Source # gmapQ :: (forall d. Data d => d -> u) -> TyCon -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> TyCon -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TyCon -> m TyCon Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TyCon -> m TyCon Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TyCon -> m TyCon Source # | |
| NamedThing TyCon # | |
Defined in GHC.Core.TyCon | |
| Uniquable TyCon # | |
Defined in GHC.Core.TyCon | |
| Outputable TyCon # | |
| Eq TyCon # | |
data AlgTyConRhs #
Represents right-hand-sides of TyCons for algebraic types
Constructors
| AbstractTyCon | Says that we know nothing about this data type, except that it's represented by a pointer. Used when we export a data type abstractly into an .hi file. |
| DataTyCon | Information about those |
Fields
| |
| TupleTyCon | |
| SumTyCon | An unboxed sum type. |
Fields
| |
| NewTyCon | Information about those |
Fields
| |
visibleDataCons :: AlgTyConRhs -> [DataCon] #
Both type classes as well as family instances imply implicit type constructors. These implicit type constructors refer to their parent structure (ie, the class or family from which they derive) using a type of the following form.
Extract those DataCons that we are able to learn about. Note
that visibility in this sense does not correspond to visibility in
the context of any particular user program!
data AlgTyConFlav #
Constructors
| VanillaAlgTyCon TyConRepName | An ordinary type constructor has no parent. |
| UnboxedAlgTyCon (Maybe TyConRepName) | An unboxed type constructor. The TyConRepName is a Maybe since we currently don't allow unboxed sums to be Typeable since there are too many of them. See #13276. |
| ClassTyCon Class TyConRepName | Type constructors representing a class dictionary. See Note [ATyCon for classes] in GHC.Core.TyCo.Rep |
| DataFamInstTyCon (CoAxiom Unbranched) TyCon [Type] | Type constructors representing an *instance* of a *data* family. Parameters: 1) The type family in question 2) Instance types; free variables are the 3) A |
Instances
| Outputable AlgTyConFlav # | |
Defined in GHC.Core.TyCon | |
isNoParent :: AlgTyConFlav -> Bool #
data FamTyConFlav #
Information pertaining to the expansion of a type synonym (type)
Constructors
| DataFamilyTyCon TyConRepName | Represents an open type family without a fixed right hand side. Additional instances can appear at any time. These are introduced by either a top level declaration: data family T a :: * Or an associated data type declaration, within a class declaration: class C a b where data T b :: * |
| OpenSynFamilyTyCon | An open type synonym family e.g. |
| ClosedSynFamilyTyCon (Maybe (CoAxiom Branched)) | A closed type synonym family e.g.
|
| AbstractClosedSynFamilyTyCon | A closed type synonym family declared in an hs-boot file with type family F a where .. |
| BuiltInSynFamTyCon BuiltInSynFamily | Built-in type family used by the TypeNats solver |
Instances
| Outputable FamTyConFlav # | |
Defined in GHC.Core.TyCon | |
Constructors
| Nominal | |
| Representational | |
| Phantom |
Instances
| Data Role # | |
Defined in GHC.Core.Coercion.Axiom Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Role -> c Role Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Role Source # toConstr :: Role -> Constr Source # dataTypeOf :: Role -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Role) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Role) Source # gmapT :: (forall b. Data b => b -> b) -> Role -> Role Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Role -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Role -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Role -> m Role Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role Source # | |
| Binary Role # | |
| Outputable Role # | |
| Eq Role # | |
| Ord Role # | |
data Injectivity #
Constructors
| NotInjective | |
| Injective [Bool] |
Instances
| Binary Injectivity # | |
Defined in GHC.Core.TyCon Methods put_ :: BinHandle -> Injectivity -> IO () # put :: BinHandle -> Injectivity -> IO (Bin Injectivity) # get :: BinHandle -> IO Injectivity # | |
| Eq Injectivity # | |
Defined in GHC.Core.TyCon | |
data RuntimeRepInfo #
Some promoted datacons signify extra info relevant to GHC. For example,
the IntRep constructor of RuntimeRep corresponds to the IntRep
constructor of PrimRep. This data structure allows us to store this
information right in the TyCon. The other approach would be to look
up things like RuntimeRep's PrimRep by known-key every time.
See also Note [Getting from RuntimeRep to PrimRep] in GHC.Types.RepType
Constructors
| NoRRI | an ordinary promoted data con |
| RuntimeRep ([Type] -> [PrimRep]) | A constructor of |
| VecCount Int | A constructor of |
| VecElem PrimElemRep | A constructor of |
data TyConFlavour #
Paints a picture of what a TyCon represents, in broad strokes.
This is used towards more informative error messages.
Constructors
Instances
| Outputable TyConFlavour # | |
Defined in GHC.Core.TyCon | |
| Eq TyConFlavour # | |
Defined in GHC.Core.TyCon | |
TyConBinder
type TyConBinder = VarBndr TyVar TyConBndrVis #
data TyConBndrVis #
Constructors
| NamedTCB ArgFlag | |
| AnonTCB AnonArgFlag |
Instances
| Binary TyConBndrVis # | |
Defined in GHC.Core.TyCon Methods put_ :: BinHandle -> TyConBndrVis -> IO () # put :: BinHandle -> TyConBndrVis -> IO (Bin TyConBndrVis) # get :: BinHandle -> IO TyConBndrVis # | |
| Outputable TyConBndrVis # | |
Defined in GHC.Core.TyCon | |
| OutputableBndr tv => Outputable (VarBndr tv TyConBndrVis) # | |
Defined in GHC.Core.TyCon | |
type TyConTyCoBinder = VarBndr TyCoVar TyConBndrVis #
mkNamedTyConBinder :: ArgFlag -> TyVar -> TyConBinder #
mkNamedTyConBinders :: ArgFlag -> [TyVar] -> [TyConBinder] #
mkRequiredTyConBinder :: TyCoVarSet -> TyVar -> TyConBinder #
Make a Required TyConBinder. It chooses between NamedTCB and AnonTCB based on whether the tv is mentioned in the dependent set
mkAnonTyConBinder :: AnonArgFlag -> TyVar -> TyConBinder #
mkAnonTyConBinders :: AnonArgFlag -> [TyVar] -> [TyConBinder] #
isNamedTyConBinder :: TyConBinder -> Bool #
isVisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool #
isInvisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool #
Field labels
tyConFieldLabels :: TyCon -> [FieldLabel] #
The labels for the fields of this particular TyCon
lookupTyConFieldLabel :: FieldLabelString -> TyCon -> Maybe FieldLabel #
Look up a field label belonging to this TyCon
Constructing TyCons
Arguments
| :: Name | |
| -> [TyConBinder] | Binders of the |
| -> Kind | Result kind |
| -> [Role] | The roles for each TyVar |
| -> Maybe CType | The C type this type corresponds to when using the CAPI FFI |
| -> [PredType] | Stupid theta: see |
| -> AlgTyConRhs | Information about data constructors |
| -> AlgTyConFlav | What flavour is it? (e.g. vanilla, type family) |
| -> Bool | Was the |
| -> TyCon |
This is the making of an algebraic TyCon. Notably, you have to
pass in the generic (in the -XGenerics sense) information about the
type constructor - you can get hold of it easily (see Generics
module)
mkClassTyCon :: Name -> [TyConBinder] -> [Role] -> AlgTyConRhs -> Class -> Name -> TyCon #
Simpler specialization of mkAlgTyCon for classes
mkFunTyCon :: Name -> [TyConBinder] -> Name -> TyCon #
Arguments
| :: Name | |
| -> [TyConBinder] | |
| -> Kind | result kind, never levity-polymorphic |
| -> [Role] | |
| -> TyCon |
Create an unlifted primitive TyCon, such as Int#.
Kind constructors
Arguments
| :: Name | |
| -> [TyConBinder] | |
| -> Kind | result kind |
| -> [Role] | |
| -> TyCon |
Create a lifted primitive TyCon such as RealWorld
Arguments
| :: Name | |
| -> [TyConBinder] | |
| -> Kind | Result kind of the |
| -> Arity | Arity of the tuple |
| -> DataCon | |
| -> TupleSort | Whether the tuple is boxed or unboxed |
| -> AlgTyConFlav | |
| -> TyCon |
Arguments
| :: Name | |
| -> [TyConBinder] | |
| -> Kind | Kind of the resulting |
| -> Arity | Arity of the sum |
| -> [TyVar] |
|
| -> [DataCon] | |
| -> AlgTyConFlav | |
| -> TyCon |
mkDataTyConRhs :: [DataCon] -> AlgTyConRhs #
Create a type synonym TyCon
Arguments
| :: Name | |
| -> [TyConBinder] | |
| -> Kind | result kind |
| -> Maybe Name | |
| -> FamTyConFlav | |
| -> Maybe Class | |
| -> Injectivity | |
| -> TyCon |
Create a type family TyCon
mkPromotedDataCon :: DataCon -> Name -> TyConRepName -> [TyConTyCoBinder] -> Kind -> [Role] -> RuntimeRepInfo -> TyCon #
Create a promoted data constructor TyCon
Somewhat dodgily, we give it the same Name
as the data constructor itself; when we pretty-print
the TyCon we add a quote; see the Outputable TyCon instance
Arguments
| :: Name | |
| -> [TyConBinder] | |
| -> Kind | result kind only |
| -> [(Name, TcTyVar)] | Scoped type variables; see Note [How TcTyCons work] in GHC.Tc.TyCl |
| -> Bool | Is this TcTyCon generalised already? |
| -> TyConFlavour | What sort of |
| -> TyCon |
Makes a tycon suitable for use during type-checking. It stores a variety of details about the definition of the TyCon, but no right-hand side. It lives only during the type-checking of a mutually-recursive group of tycons; it is then zonked to a proper TyCon in zonkTcTyCon. See also Note [Kind checking recursive type and class declarations] in GHC.Tc.TyCl.
noTcTyConScopedTyVars :: [(Name, TcTyVar)] #
No scoped type variables (to be used with mkTcTyCon).
Predicates on TyCons
isAlgTyCon :: TyCon -> Bool #
Returns True if the supplied TyCon resulted from either a
data or newtype declaration
isVanillaAlgTyCon :: TyCon -> Bool #
Returns True for vanilla AlgTyCons -- that is, those created
with a data or newtype declaration.
isConstraintKindCon :: TyCon -> Bool #
Returns True for the TyCon of the Constraint kind.
isClassTyCon :: TyCon -> Bool #
Is this TyCon that for a class instance?
isFamInstTyCon :: TyCon -> Bool #
Is this TyCon that for a data family instance?
isFunTyCon :: TyCon -> Bool #
isPrimTyCon :: TyCon -> Bool #
Does this TyCon represent something that cannot be defined in Haskell?
isTupleTyCon :: TyCon -> Bool #
Does this TyCon represent a tuple?
NB: when compiling Data.Tuple, the tycons won't reply True to
isTupleTyCon, because they are built as AlgTyCons. However they
get spat into the interface file as tuple tycons, so I don't think
it matters.
isUnboxedTupleTyCon :: TyCon -> Bool #
Is this the TyCon for an unboxed tuple?
isBoxedTupleTyCon :: TyCon -> Bool #
Is this the TyCon for a boxed tuple?
isUnboxedSumTyCon :: TyCon -> Bool #
Is this the TyCon for an unboxed sum?
isPromotedTupleTyCon :: TyCon -> Bool #
Is this the TyCon for a promoted tuple?
isTypeSynonymTyCon :: TyCon -> Bool #
Is this a TyCon representing a regular H98 type synonym (type)?
mustBeSaturated :: TyCon -> Bool #
True iff we can decompose (T a b c) into ((T a b) c) I.e. is it injective and generative w.r.t nominal equality? That is, if (T a b) ~N d e f, is it always the case that (T ~N d), (a ~N e) and (b ~N f)? Specifically NOT true of synonyms (open and otherwise)
It'd be unusual to call mustBeSaturated on a regular H98 type synonym, because you should probably have expanded it first But regardless, it's not decomposable
isPromotedDataCon :: TyCon -> Bool #
Is this a PromotedDataCon?
isPromotedDataCon_maybe :: TyCon -> Maybe DataCon #
Retrieves the promoted DataCon if this is a PromotedDataCon;
isKindTyCon :: TyCon -> Bool #
Is this tycon really meant for use at the kind level? That is, should it be permitted without -XDataKinds?
isLiftedTypeKindTyConName :: Name -> Bool #
isTauTyCon :: TyCon -> Bool #
isFamFreeTyCon :: TyCon -> Bool #
isDataTyCon :: TyCon -> Bool #
Returns True for data types that are definitely represented by
heap-allocated constructors. These are scrutinised by Core-level
case expressions, and they get info tables allocated for them.
Generally, the function will be true for all data types and false
for newtypes, unboxed tuples, unboxed sums and type family
TyCons. But it is not guaranteed to return True in all cases
that it could.
NB: for a data type family, only the instance TyCons
get an info table. The family declaration TyCon does not
isProductTyCon :: TyCon -> Bool #
isDataSumTyCon_maybe :: TyCon -> Maybe [DataCon] #
isEnumerationTyCon :: TyCon -> Bool #
Is this an algebraic TyCon which is just an enumeration of values?
isNewTyCon :: TyCon -> Bool #
Is this TyCon that for a newtype
isAbstractTyCon :: TyCon -> Bool #
Test if the TyCon is algebraic but abstract (invisible data constructors)
isFamilyTyCon :: TyCon -> Bool #
Is this a TyCon, synonym or otherwise, that defines a family?
isOpenFamilyTyCon :: TyCon -> Bool #
Is this a TyCon, synonym or otherwise, that defines a family with
instances?
isTypeFamilyTyCon :: TyCon -> Bool #
Is this a synonym TyCon that can have may have further instances appear?
isDataFamilyTyCon :: TyCon -> Bool #
Is this a synonym TyCon that can have may have further instances appear?
isOpenTypeFamilyTyCon :: TyCon -> Bool #
Is this an open type family TyCon?
isClosedSynFamilyTyConWithAxiom_maybe :: TyCon -> Maybe (CoAxiom Branched) #
Is this a non-empty closed type family? Returns Nothing for
abstract or empty closed families.
tyConInjectivityInfo :: TyCon -> Injectivity #
returns tyConInjectivityInfo tc is Injective istc is an
injective tycon (where is states for which tyConBinders tc is
injective), or NotInjective otherwise.
isUnliftedTyCon :: TyCon -> Bool #
isGadtSyntaxTyCon :: TyCon -> Bool #
Is this an algebraic TyCon declared with the GADT syntax?
isInjectiveTyCon :: TyCon -> Role -> Bool #
isInjectiveTyCon is true of TyCons for which this property holds
(where X is the role passed in):
If (T a1 b1 c1) ~X (T a2 b2 c2), then (a1 ~X1 a2), (b1 ~X2 b2), and (c1 ~X3 c2)
(where X1, X2, and X3, are the roles given by tyConRolesX tc X)
See also Note [Decomposing equality] in GHC.Tc.Solver.Canonical
isGenerativeTyCon :: TyCon -> Role -> Bool #
isGenerativeTyCon is true of TyCons for which this property holds
(where X is the role passed in):
If (T tys ~X t), then (t's head ~X T).
See also Note [Decomposing equality] in GHC.Tc.Solver.Canonical
isGenInjAlgRhs :: AlgTyConRhs -> Bool #
Is this an AlgTyConRhs of a TyCon that is generative and injective
with respect to representational equality?
isTyConAssoc :: TyCon -> Bool #
Is this TyCon for an associated type?
tyConAssoc_maybe :: TyCon -> Maybe TyCon #
Get the enclosing class TyCon (if there is one) for the given TyCon.
tyConFlavourAssoc_maybe :: TyConFlavour -> Maybe TyCon #
Get the enclosing class TyCon (if there is one) for the given TyConFlavour
isImplicitTyCon :: TyCon -> Bool #
Identifies implicit tycons that, in particular, do not go into interface files (because they are implicitly reconstructed when the interface is read).
Note that:
- Associated families are implicit, as they are re-constructed from the class declaration in which they reside, and
- Family instances are not implicit as they represent the instance body
(similar to a
dfundoes that for a class instance). - Tuples are implicit iff they have a wired-in name (namely: boxed and unboxed tuples are wired-in and implicit, but constraint tuples are not)
isTyConWithSrcDataCons :: TyCon -> Bool #
Check if the tycon actually refers to a proper `data` or `newtype` with user defined constructors rather than one from a class or other construction.
setTcTyConKind :: TyCon -> Kind -> TyCon #
isTcLevPoly :: TyCon -> Bool #
Could this TyCon ever be levity-polymorphic when fully applied? True is safe. False means we're sure. Does only a quick check based on the TyCon's category. Precondition: The fully-applied TyCon has kind (TYPE blah)
Extracting information out of TyCons
tyConSkolem :: TyCon -> Bool #
Returns whether or not this TyCon is definite, or a hole
that may be filled in at some later point. See Note [Skolem abstract data]
tyConUnique :: TyCon -> Unique #
A Unique of this TyCon. Invariant: identical to Unique of Name stored in tyConName field.
tyConTyVars :: TyCon -> [TyVar] #
TyVar binders
tyConVisibleTyVars :: TyCon -> [TyVar] #
tyConCType :: TyCon -> Maybe CType #
The C type that should be used for this type when using the FFI and CAPI
tyConCType_maybe :: TyCon -> Maybe CType #
tyConDataCons :: TyCon -> [DataCon] #
As tyConDataCons_maybe, but returns the empty list of constructors if no
constructors could be found
tyConDataCons_maybe :: TyCon -> Maybe [DataCon] #
tyConSingleDataCon_maybe :: TyCon -> Maybe DataCon #
If the given TyCon has a single data constructor, i.e. it is a data
type with one alternative, a tuple type or a newtype then that constructor
is returned. If the TyCon has more than one constructor, or represents a
primitive or function type constructor then Nothing is returned. In any
other case, the function panics
tyConSingleDataCon :: TyCon -> DataCon #
tyConFamilySize :: TyCon -> Int #
tyConStupidTheta :: TyCon -> [PredType] #
Find the "stupid theta" of the TyCon. A "stupid theta" is the context
to the left of an algebraic type declaration, e.g. Eq a in the declaration
data Eq a => T a ...
tyConArity :: TyCon -> Arity #
Arity
tyConRoles :: TyCon -> [Role] #
Get the list of roles for the type parameters of a TyCon
tyConFlavour :: TyCon -> TyConFlavour #
tyConTuple_maybe :: TyCon -> Maybe TupleSort #
tyConClass_maybe :: TyCon -> Maybe Class #
If this TyCon is that for a class instance, return the class it is for.
Otherwise returns Nothing
tyConFamInst_maybe :: TyCon -> Maybe (TyCon, [Type]) #
If this TyCon is that of a data family instance, return the family in question
and the instance types. Otherwise, return Nothing
tyConFamInstSig_maybe :: TyCon -> Maybe (TyCon, [Type], CoAxiom Unbranched) #
tyConFamilyResVar_maybe :: TyCon -> Maybe Name #
Extract type variable naming the result of injective type family
synTyConDefn_maybe :: TyCon -> Maybe ([TyVar], Type) #
Extract the TyVars bound by a vanilla type synonym
and the corresponding (unsubstituted) right hand side.
synTyConRhs_maybe :: TyCon -> Maybe Type #
Extract the information pertaining to the right hand side of a type synonym
(type) declaration.
famTyConFlav_maybe :: TyCon -> Maybe FamTyConFlav #
Extract the flavour of a type family (with all the extra information that it carries)
famTcResVar :: TyCon -> Maybe Name #
Name of result type variable, used for pretty-printing with --show-iface and for reifying TyCon in Template Haskell
algTyConRhs :: TyCon -> AlgTyConRhs #
Extract an AlgTyConRhs with information about data constructors from an
algebraic or tuple TyCon. Panics for any other sort of TyCon
newTyConRhs :: TyCon -> ([TyVar], Type) #
newTyConEtadArity :: TyCon -> Int #
The number of type parameters that need to be passed to a newtype to resolve it. May be less than in the definition if it can be eta-contracted.
newTyConEtadRhs :: TyCon -> ([TyVar], Type) #
unwrapNewTyCon_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched) #
unwrapNewTyConEtad_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched) #
newTyConDataCon_maybe :: TyCon -> Maybe DataCon #
algTcFields :: TyCon -> FieldLabelEnv #
Maps a label to information about the field
tyConRuntimeRepInfo :: TyCon -> RuntimeRepInfo #
Extract any RuntimeRepInfo from this TyCon
tyConBinders :: TyCon -> [TyConBinder] #
Full binders
tyConResKind :: TyCon -> Kind #
Result kind
tyConInvisTVBinders :: [TyConBinder] -> [InvisTVBinder] #
tcTyConScopedTyVars :: TyCon -> [(Name, TyVar)] #
Scoped tyvars over the tycon's body See Note [Scoped tyvars in a TcTyCon]
tcTyConIsPoly :: TyCon -> Bool #
Is this TcTyCon already generalized?
mkTyConTagMap :: TyCon -> NameEnv ConTag #
Manipulating TyCons
Arguments
| :: TyCon | |
| -> [tyco] | Arguments to |
| -> Maybe ([(TyVar, tyco)], Type, [tyco]) | Returns a |
Expand a type synonym application, if any
newTyConCo :: TyCon -> CoAxiom Unbranched #
newTyConCo_maybe :: TyCon -> Maybe (CoAxiom Unbranched) #
pprPromotionQuote :: TyCon -> SDoc #
mkTyConKind :: [TyConBinder] -> Kind -> Kind #
Predicated on TyConFlavours
tcFlavourIsOpen :: TyConFlavour -> Bool #
Is this flavour of TyCon an open type family or a data family?
Runtime type representation
type TyConRepName = Name #
mkPrelTyConRepName :: Name -> TyConRepName #
Make a Name for the Typeable representation of the given wired-in type
tyConRepModOcc :: Module -> OccName -> (Module, OccName) #
The name (and defining module) for the Typeable representation (TyCon) of a type constructor.
See Note [Grand plan for Typeable] in GHC.Tc.Instance.Typeable.
Primitive representations of Types
A PrimRep is an abstraction of a type. It contains information that
the code generator needs in order to pass arguments, return results,
and store values of this type. See also Note [RuntimeRep and PrimRep] in
GHC.Types.RepType and Note [VoidRep] in GHC.Types.RepType.
Constructors
| VoidRep | |
| LiftedRep | |
| UnliftedRep | Unlifted pointer |
| Int8Rep | Signed, 8-bit value |
| Int16Rep | Signed, 16-bit value |
| Int32Rep | Signed, 32-bit value |
| Int64Rep | Signed, 64 bit value (with 32-bit words only) |
| IntRep | Signed, word-sized value |
| Word8Rep | Unsigned, 8 bit value |
| Word16Rep | Unsigned, 16 bit value |
| Word32Rep | Unsigned, 32 bit value |
| Word64Rep | Unsigned, 64 bit value (with 32-bit words only) |
| WordRep | Unsigned, word-sized value |
| AddrRep | A pointer, but not to a Haskell value (use '(Un)liftedRep') |
| FloatRep | |
| DoubleRep | |
| VecRep Int PrimElemRep | A vector |
data PrimElemRep #
Constructors
| Int8ElemRep | |
| Int16ElemRep | |
| Int32ElemRep | |
| Int64ElemRep | |
| Word8ElemRep | |
| Word16ElemRep | |
| Word32ElemRep | |
| Word64ElemRep | |
| FloatElemRep | |
| DoubleElemRep |
Instances
| Show PrimElemRep # | |
Defined in GHC.Core.TyCon | |
| Outputable PrimElemRep # | |
Defined in GHC.Core.TyCon | |
| Eq PrimElemRep # | |
Defined in GHC.Core.TyCon | |
isGcPtrRep :: PrimRep -> Bool #
primRepSizeB :: Platform -> PrimRep -> Int #
The size of a PrimRep in bytes.
This applies also when used in a constructor, where we allow packing the
fields. For instance, in data Foo = Foo Float# Float# the two fields will
take only 8 bytes, which for 64-bit arch will be equal to 1 word.
See also mkVirtHeapOffsetsWithPadding for details of how data fields are
laid out.
primElemRepSizeB :: PrimElemRep -> Int #
primRepIsFloat :: PrimRep -> Maybe Bool #
Return if Rep stands for floating type, returns Nothing for vector types.
Recursion breaking
data RecTcChecker #
Initialise a RecTcChecker with defaultRecTcMaxBound.
The default upper bound (100) for the number of times a RecTcChecker is
allowed to encounter each TyCon.
setRecTcMaxBound :: Int -> RecTcChecker -> RecTcChecker #
Change the upper bound for the number of times a RecTcChecker is allowed
to encounter each TyCon.
checkRecTc :: RecTcChecker -> TyCon -> Maybe RecTcChecker #