Safe Haskell  None 

Language  Haskell2010 
 data TyCon
 data AlgTyConRhs
 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
 tyConFieldLabels :: TyCon > [FieldLabel]
 tyConFieldLabelEnv :: TyCon > FieldLabelEnv
 mkAlgTyCon :: Name > [TyBinder] > Kind > [TyVar] > [Role] > Maybe CType > [PredType] > AlgTyConRhs > AlgTyConFlav > RecFlag > Bool > TyCon
 mkClassTyCon :: Name > [TyBinder] > [TyVar] > [Role] > AlgTyConRhs > Class > RecFlag > Name > TyCon
 mkFunTyCon :: Name > [TyBinder] > Name > TyCon
 mkPrimTyCon :: Name > [TyBinder] > Kind > [Role] > TyCon
 mkKindTyCon :: Name > [TyBinder] > Kind > [Role] > Name > TyCon
 mkLiftedPrimTyCon :: Name > [TyBinder] > Kind > [Role] > TyCon
 mkTupleTyCon :: Name > [TyBinder] > Kind > Arity > [TyVar] > DataCon > TupleSort > AlgTyConFlav > TyCon
 mkSynonymTyCon :: Name > [TyBinder] > Kind > [TyVar] > [Role] > Type > TyCon
 mkFamilyTyCon :: Name > [TyBinder] > Kind > [TyVar] > Maybe Name > FamTyConFlav > Maybe Class > Injectivity > TyCon
 mkPromotedDataCon :: DataCon > Name > TyConRepName > [TyBinder] > Kind > [Role] > RuntimeRepInfo > TyCon
 mkTcTyCon :: Name > [TyVar] > [TyBinder] > Kind > Bool > [TyVar] > TyCon
 isAlgTyCon :: TyCon > Bool
 isVanillaAlgTyCon :: TyCon > Bool
 isClassTyCon :: TyCon > Bool
 isFamInstTyCon :: TyCon > Bool
 isFunTyCon :: TyCon > Bool
 isPrimTyCon :: TyCon > Bool
 isTupleTyCon :: TyCon > Bool
 isUnboxedTupleTyCon :: TyCon > Bool
 isBoxedTupleTyCon :: TyCon > Bool
 isTypeSynonymTyCon :: TyCon > Bool
 mightBeUnsaturatedTyCon :: TyCon > Bool
 isPromotedDataCon :: TyCon > Bool
 isPromotedDataCon_maybe :: TyCon > Maybe DataCon
 isKindTyCon :: TyCon > Bool
 isLiftedTypeKindTyConName :: Name > Bool
 isDataTyCon :: TyCon > Bool
 isProductTyCon :: TyCon > Bool
 isDataProductTyCon_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)
 familyTyConInjectivityInfo :: 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 Class
 isRecursiveTyCon :: TyCon > Bool
 isImplicitTyCon :: TyCon > Bool
 isTyConWithSrcDataCons :: TyCon > Bool
 isTcTyCon :: TyCon > Bool
 tyConName :: TyCon > Name
 tyConKind :: TyCon > Kind
 tyConUnique :: TyCon > Unique
 tyConTyVars :: 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 > String
 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 > [TyBinder]
 tyConResKind :: TyCon > Kind
 tcTyConScopedTyVars :: TyCon > [TyVar]
 expandSynTyCon_maybe :: TyCon > [tyco] > Maybe ([(TyVar, tyco)], Type, [tyco])
 makeTyConAbstract :: TyCon > TyCon
 newTyConCo :: TyCon > CoAxiom Unbranched
 newTyConCo_maybe :: TyCon > Maybe (CoAxiom Unbranched)
 pprPromotionQuote :: TyCon > SDoc
 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
 primRepSizeW :: DynFlags > PrimRep > Int
 primElemRepSizeB :: PrimElemRep > Int
 primRepIsFloat :: PrimRep > Maybe Bool
 data RecTcChecker
 initRecTc :: 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.
data AlgTyConRhs Source #
Represents righthandsides of TyCon
s for algebraic types
AbstractTyCon Bool  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 
TupleTyCon  
NewTyCon  Information about those 

visibleDataCons :: AlgTyConRhs > [DataCon] Source #
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 DataCon
s 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 Source #
VanillaAlgTyCon TyConRepName  An ordinary type constructor has no parent. 
UnboxedAlgTyCon  An unboxed type constructor. Note that this carries no TyConRepName as it is not representable. 
ClassTyCon Class TyConRepName  Type constructors representing a class dictionary. See Note [ATyCon for classes] in TyCoRep 
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 
isNoParent :: AlgTyConFlav > Bool Source #
data FamTyConFlav Source #
Information pertaining to the expansion of a type synonym (type
)
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 hsboot file with type family F a where .. 
BuiltInSynFamTyCon BuiltInSynFamily  Builtin type family used by the TypeNats solver 
data RuntimeRepInfo Source #
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 knownkey every time.
NoRRI  an ordinary promoted data con 
RuntimeRep ([Type] > PrimRep)  A constructor of 
VecCount Int  A constructor of 
VecElem PrimElemRep  A constructor of 
Field labels
tyConFieldLabels :: TyCon > [FieldLabel] Source #
The labels for the fields of this particular TyCon
tyConFieldLabelEnv :: TyCon > FieldLabelEnv Source #
The labels for the fields of this particular TyCon
Constructing TyCons
:: Name  
> [TyBinder]  Binders of the resulting 
> Kind  Result kind 
> [TyVar] 

> [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) 
> RecFlag  Is the 
> 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 > [TyBinder] > [TyVar] > [Role] > AlgTyConRhs > Class > RecFlag > Name > TyCon Source #
Simpler specialization of mkAlgTyCon
for classes
Create an unlifted primitive TyCon
, such as Int#
Kind constructors
Create a lifted primitive TyCon
such as RealWorld
Create a type synonym TyCon
:: Name  
> [TyBinder]  
> Kind  result kind 
> [TyVar]  
> Maybe Name  
> FamTyConFlav  
> Maybe Class  
> Injectivity  
> TyCon 
Create a type family TyCon
mkPromotedDataCon :: DataCon > Name > TyConRepName > [TyBinder] > Kind > [Role] > RuntimeRepInfo > TyCon Source #
Create a promoted data constructor TyCon
Somewhat dodgily, we give it the same Name
as the data constructor itself; when we prettyprint
the TyCon we add a quote; see the Outputable TyCon instance
:: Name  
> [TyVar]  
> [TyBinder]  
> Kind  result kind only 
> Bool  Can this be unsaturated? 
> [TyVar]  Scoped type variables, see Note [TcTyCon] 
> TyCon 
Makes a tycon suitable for use during typechecking. The only real need for this is for printing error messages during a recursive type/class typechecking knot. It has a kind because TcErrors sometimes calls typeKind. See also Note [Kind checking recursive type and class declarations] in TcTyClsDecls.
Predicates on TyCons
isAlgTyCon :: TyCon > Bool Source #
Returns True
if the supplied TyCon
resulted from either a
data
or newtype
declaration
isVanillaAlgTyCon :: TyCon > Bool Source #
Returns True
for vanilla AlgTyCons  that is, those created
with a data
or newtype
declaration.
isFunTyCon :: TyCon > Bool Source #
isPrimTyCon :: TyCon > Bool Source #
Does this TyCon
represent something that cannot be defined in Haskell?
isTupleTyCon :: TyCon > Bool Source #
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.
isTypeSynonymTyCon :: TyCon > Bool Source #
Is this a TyCon
representing a regular H98 type synonym (type
)?
mightBeUnsaturatedTyCon :: TyCon > Bool Source #
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 mightBeUnsaturatedTyCon on a regular H98 type synonym, because you should probably have expanded it first But regardless, it's not decomposable
isPromotedDataCon :: TyCon > Bool Source #
Is this a PromotedDataCon?
isPromotedDataCon_maybe :: TyCon > Maybe DataCon Source #
Retrieves the promoted DataCon if this is a PromotedDataCon;
isKindTyCon :: TyCon > Bool Source #
Is this tycon really meant for use at the kind level? That is, should it be permitted without XDataKinds?
isLiftedTypeKindTyConName :: Name > Bool Source #
isDataTyCon :: TyCon > Bool Source #
Returns True
for data types that are definitely represented by
heapallocated constructors. These are scrutinised by Corelevel
case
expressions, and they get info tables allocated for them.
Generally, the function will be true for all data
types and false
for newtype
s, unboxed tuples and type family TyCon
s. But it is
not guaranteed to return True
in all cases that it could.
NB: for a data type family, only the instance TyCon
s
get an info table. The family declaration TyCon
does not
isProductTyCon :: TyCon > Bool Source #
isEnumerationTyCon :: TyCon > Bool Source #
Is this an algebraic TyCon
which is just an enumeration of values?
isAbstractTyCon :: TyCon > Bool Source #
Test if the TyCon
is algebraic but abstract (invisible data constructors)
isFamilyTyCon :: TyCon > Bool Source #
Is this a TyCon
, synonym or otherwise, that defines a family?
isOpenFamilyTyCon :: TyCon > Bool Source #
Is this a TyCon
, synonym or otherwise, that defines a family with
instances?
isTypeFamilyTyCon :: TyCon > Bool Source #
Is this a synonym TyCon
that can have may have further instances appear?
isDataFamilyTyCon :: TyCon > Bool Source #
Is this a synonym TyCon
that can have may have further instances appear?
isOpenTypeFamilyTyCon :: TyCon > Bool Source #
Is this an open type family TyCon?
isClosedSynFamilyTyConWithAxiom_maybe :: TyCon > Maybe (CoAxiom Branched) Source #
Is this a nonempty closed type family? Returns Nothing
for
abstract or empty closed families.
familyTyConInjectivityInfo :: TyCon > Injectivity Source #
Try to read the injectivity information from a FamilyTyCon. For every other TyCon this function panics.
isUnliftedTyCon :: TyCon > Bool Source #
isGadtSyntaxTyCon :: TyCon > Bool Source #
Is this an algebraic TyCon
declared with the GADT syntax?
isInjectiveTyCon :: TyCon > Role > Bool Source #
isInjectiveTyCon
is true of TyCon
s 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 equalities] in TcCanonical
isGenerativeTyCon :: TyCon > Role > Bool Source #
isGenerativeTyCon
is true of TyCon
s 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 equalities] in TcCanonical
isGenInjAlgRhs :: AlgTyConRhs > Bool Source #
Is this an AlgTyConRhs
of a TyCon
that is generative and injective
with respect to representational equality?
isTyConAssoc :: TyCon > Bool Source #
isImplicitTyCon :: TyCon > Bool Source #
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 reconstructed from the class declaration in which they reside, and
 Family instances are not implicit as they represent the instance body
(similar to a
dfun
does that for a class instance).  Tuples are implicit iff they have a wiredin name (namely: boxed and unboxed tupeles are wiredin and implicit, but constraint tuples are not)
isTyConWithSrcDataCons :: TyCon > Bool Source #
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.
isTcTyCon :: TyCon > Bool Source #
Is this a TcTyCon? (That is, one only used during typechecking?)
Extracting information out of TyCons
tyConUnique :: TyCon > Unique Source #
A Unique of this TyCon. Invariant: identical to Unique of Name stored in tyConName field.
tyConTyVars :: TyCon > [TyVar] Source #
The kind and type variables used in the type constructor. Invariant: length tyvars = arity Precisely, this list scopes over:
 The
algTcStupidTheta
 The cached types in algTyConRhs.NewTyCon
 The family instance types if present
Note that it does not scope over the data constructors.
tyConCType :: TyCon > Maybe CType Source #
The C type that should be used for this type when using the FFI and CAPI
tyConDataCons :: TyCon > [DataCon] Source #
As tyConDataCons_maybe
, but returns the empty list of constructors if no
constructors could be found
tyConSingleDataCon_maybe :: TyCon > Maybe DataCon Source #
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 Source #
tyConFamilySize :: TyCon > Int Source #
tyConStupidTheta :: TyCon > [PredType] Source #
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 Source #
Number of arguments this TyCon must receive to be considered saturated (including implicit kind variables)
tyConRoles :: TyCon > [Role] Source #
Get the list of roles for the type parameters of a TyCon
tyConFlavour :: TyCon > String Source #
tyConClass_maybe :: TyCon > Maybe Class Source #
If this TyCon
is that for a class instance, return the class it is for.
Otherwise returns Nothing
tyConFamInst_maybe :: TyCon > Maybe (TyCon, [Type]) Source #
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) Source #
tyConFamilyResVar_maybe :: TyCon > Maybe Name Source #
Extract type variable naming the result of injective type family
synTyConDefn_maybe :: TyCon > Maybe ([TyVar], Type) Source #
Extract the TyVar
s bound by a vanilla type synonym
and the corresponding (unsubstituted) right hand side.
synTyConRhs_maybe :: TyCon > Maybe Type Source #
Extract the information pertaining to the right hand side of a type synonym
(type
) declaration.
famTyConFlav_maybe :: TyCon > Maybe FamTyConFlav Source #
Extract the flavour of a type family (with all the extra information that it carries)
famTcResVar :: TyCon > Maybe Name Source #
Name of result type variable, used for prettyprinting with showiface and for reifying TyCon in Template Haskell
algTyConRhs :: TyCon > AlgTyConRhs Source #
Extract an AlgTyConRhs
with information about data constructors from an
algebraic or tuple TyCon
. Panics for any other sort of TyCon
newTyConEtadArity :: TyCon > Int Source #
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 etacontracted.
unwrapNewTyCon_maybe :: TyCon > Maybe ([TyVar], Type, CoAxiom Unbranched) Source #
unwrapNewTyConEtad_maybe :: TyCon > Maybe ([TyVar], Type, CoAxiom Unbranched) Source #
algTcFields :: TyCon > FieldLabelEnv Source #
Maps a label to information about the field
tyConRuntimeRepInfo :: TyCon > RuntimeRepInfo Source #
Extract any RuntimeRepInfo
from this TyCon
tyConBinders :: TyCon > [TyBinder] Source #
The TyBinders for this TyCon's kind. length tyConBinders == tyConArity. This is a cached value and is redundant with the tyConKind.
tyConResKind :: TyCon > Kind Source #
Cached result kind
tcTyConScopedTyVars :: TyCon > [TyVar] Source #
Scoped tyvars over the tycon's body. See Note [TcTyCon]
Manipulating TyCons
:: TyCon  
> [tyco]  Arguments to 
> Maybe ([(TyVar, tyco)], Type, [tyco])  Returns a 
Expand a type synonym application, if any
makeTyConAbstract :: TyCon > TyCon Source #
Make an fake, abstract TyCon
from an existing one.
Used when recovering from errors
newTyConCo :: TyCon > CoAxiom Unbranched Source #
newTyConCo_maybe :: TyCon > Maybe (CoAxiom Unbranched) Source #
pprPromotionQuote :: TyCon > SDoc Source #
Runtime type representation
type TyConRepName = Name Source #
tyConRepModOcc :: Module > OccName > (Module, OccName) Source #
The name (and defining module) for the Typeable representation (TyCon) of a type constructor.
See Note [Grand plan for Typeable] in TcTypeable
in TcTypeable.
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.
data PrimElemRep Source #
isGcPtrRep :: PrimRep > Bool Source #
primElemRepSizeB :: PrimElemRep > Int Source #
primRepIsFloat :: PrimRep > Maybe Bool Source #
Return if Rep stands for floating type, returns Nothing for vector types.
Recursion breaking
data RecTcChecker Source #
checkRecTc :: RecTcChecker > TyCon > Maybe RecTcChecker Source #