Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Plugin = Plugin {
- installCoreToDos :: CorePlugin
- tcPlugin :: TcPlugin
- holeFitPlugin :: HoleFitPlugin
- dynflagsPlugin :: [CommandLineOption] -> DynFlags -> IO DynFlags
- pluginRecompile :: [CommandLineOption] -> IO PluginRecompile
- parsedResultAction :: [CommandLineOption] -> ModSummary -> HsParsedModule -> Hsc HsParsedModule
- renamedResultAction :: [CommandLineOption] -> TcGblEnv -> HsGroup GhcRn -> TcM (TcGblEnv, HsGroup GhcRn)
- typeCheckResultAction :: [CommandLineOption] -> ModSummary -> TcGblEnv -> TcM TcGblEnv
- spliceRunAction :: [CommandLineOption] -> LHsExpr GhcTc -> TcM (LHsExpr GhcTc)
- interfaceLoadAction :: forall lcl. [CommandLineOption] -> ModIface -> IfM lcl ModIface
- tcInferApps :: TcTyMode -> LHsType GhcRn -> TcType -> [LHsTypeArg GhcRn] -> TcM (TcType, TcKind)
- newWanted :: CtLoc -> PredType -> TcPluginM CtEvidence
- newFlexiTyVar :: Kind -> TcPluginM TcTyVar
- matchFam :: TyCon -> [Type] -> TcPluginM (Maybe (TcCoercion, TcType))
- getTopEnv :: TcPluginM HscEnv
- tcLookupClass :: Name -> TcPluginM Class
- tcLookupTyCon :: Name -> TcPluginM TyCon
- lookupOrig :: Module -> OccName -> TcPluginM Name
- tcPluginTrace :: String -> SDoc -> TcPluginM ()
- tcPluginIO :: IO a -> TcPluginM a
- defaultPlugin :: Plugin
- purePlugin :: [CommandLineOption] -> IO PluginRecompile
- data TcPluginM a
- data TcPlugin = TcPlugin {
- tcPluginInit :: TcPluginM s
- tcPluginSolve :: s -> TcPluginSolver
- tcPluginStop :: s -> TcPluginM ()
- data TcPluginResult
- = TcPluginContradiction [Ct]
- | TcPluginOk [(EvTerm, Ct)] [Ct]
- typeNatCoAxiomRules :: Map FastString CoAxiomRule
- typeSymbolAppendTyCon :: TyCon
- typeSymbolCmpTyCon :: TyCon
- typeNatCmpTyCon :: TyCon
- typeNatLeqTyCon :: TyCon
- typeNatLogTyCon :: TyCon
- typeNatExpTyCon :: TyCon
- typeNatModTyCon :: TyCon
- typeNatDivTyCon :: TyCon
- typeNatMulTyCon :: TyCon
- typeNatSubTyCon :: TyCon
- typeNatAddTyCon :: TyCon
- typeNatTyCons :: [TyCon]
- isWanted :: CtEvidence -> Bool
- ctEvPred :: CtEvidence -> TcPredType
- ctEvidence :: Ct -> CtEvidence
- data Ct
- data HscEnv
- lookupTyCon :: MonadThings m => Name -> m TyCon
- data EvTerm
- tcTyFamInsts :: Type -> [(TyCon, [Type])]
- promotedGTDataCon :: TyCon
- promotedEQDataCon :: TyCon
- promotedLTDataCon :: TyCon
- promotedFalseDataCon :: TyCon
- promotedTrueDataCon :: TyCon
- boolTyCon :: TyCon
- eqTyConName :: Name
- isEqPred :: PredType -> Bool
- data Pred
- data EqRel
- mkPrimEqPredRole :: Role -> Type -> Type -> PredType
- typeKind :: HasDebugCallStack => Type -> Kind
- splitTyConApp :: Type -> (TyCon, [Type])
- tyConAppTyCon_maybe :: Type -> Maybe TyCon
- unionTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst
- emptyTCvSubst :: TCvSubst
- data TCvSubst = TCvSubst InScopeSet TvSubstEnv CvSubstEnv
- type TvSubstEnv = TyVarEnv Type
- mkTyConTy :: TyCon -> Type
- mkTyVarTy :: TyVar -> Type
- eqType :: Type -> Type -> Bool
- splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])
- tyConSkolem :: TyCon -> Bool
- checkRecTc :: RecTcChecker -> TyCon -> Maybe RecTcChecker
- setRecTcMaxBound :: Int -> RecTcChecker -> RecTcChecker
- defaultRecTcMaxBound :: Int
- initRecTc :: RecTcChecker
- pprPromotionQuote :: TyCon -> SDoc
- tcFlavourIsOpen :: TyConFlavour -> Bool
- tyConFlavour :: TyCon -> TyConFlavour
- mkTyConTagMap :: TyCon -> NameEnv ConTag
- tyConRuntimeRepInfo :: TyCon -> RuntimeRepInfo
- tyConFamilyCoercion_maybe :: TyCon -> Maybe (CoAxiom Unbranched)
- tyConFamInst_maybe :: TyCon -> Maybe (TyCon, [Type])
- tyConFamInstSig_maybe :: TyCon -> Maybe (TyCon, [Type], CoAxiom Unbranched)
- isFamInstTyCon :: TyCon -> Bool
- tyConATs :: TyCon -> [TyCon]
- tyConClass_maybe :: TyCon -> Maybe Class
- isClassTyCon :: TyCon -> Bool
- famTyConFlav_maybe :: TyCon -> Maybe FamTyConFlav
- synTyConRhs_maybe :: TyCon -> Maybe Type
- synTyConDefn_maybe :: TyCon -> Maybe ([TyVar], Type)
- tyConStupidTheta :: TyCon -> [PredType]
- newTyConDataCon_maybe :: TyCon -> Maybe DataCon
- newTyConCo :: TyCon -> CoAxiom Unbranched
- newTyConCo_maybe :: TyCon -> Maybe (CoAxiom Unbranched)
- newTyConEtadRhs :: TyCon -> ([TyVar], Type)
- newTyConEtadArity :: TyCon -> Int
- newTyConRhs :: TyCon -> ([TyVar], Type)
- tyConRoles :: TyCon -> [Role]
- tyConFamilyResVar_maybe :: TyCon -> Maybe Name
- algTyConRhs :: TyCon -> AlgTyConRhs
- tyConFamilySize :: TyCon -> Int
- tyConSingleAlgDataCon_maybe :: TyCon -> Maybe DataCon
- tyConSingleDataCon :: TyCon -> DataCon
- tyConSingleDataCon_maybe :: TyCon -> Maybe DataCon
- tyConDataCons_maybe :: TyCon -> Maybe [DataCon]
- tyConDataCons :: TyCon -> [DataCon]
- isTyConWithSrcDataCons :: TyCon -> Bool
- expandSynTyCon_maybe :: TyCon -> [tyco] -> Maybe ([(TyVar, tyco)], Type, [tyco])
- isTcLevPoly :: TyCon -> Bool
- setTcTyConKind :: TyCon -> Kind -> TyCon
- isTcTyCon :: TyCon -> Bool
- tyConCType_maybe :: TyCon -> Maybe CType
- isImplicitTyCon :: TyCon -> Bool
- isLiftedTypeKindTyConName :: Name -> Bool
- isKindTyCon :: TyCon -> Bool
- isPromotedDataCon_maybe :: TyCon -> Maybe DataCon
- isPromotedDataCon :: TyCon -> Bool
- isPromotedTupleTyCon :: TyCon -> Bool
- isUnboxedSumTyCon :: TyCon -> Bool
- isBoxedTupleTyCon :: TyCon -> Bool
- tyConTuple_maybe :: TyCon -> Maybe TupleSort
- tyConFlavourAssoc_maybe :: TyConFlavour -> Maybe TyCon
- tyConAssoc_maybe :: TyCon -> Maybe TyCon
- isTyConAssoc :: TyCon -> Bool
- isBuiltInSynFamTyCon_maybe :: TyCon -> Maybe BuiltInSynFamily
- tyConInjectivityInfo :: TyCon -> Injectivity
- isClosedSynFamilyTyConWithAxiom_maybe :: TyCon -> Maybe (CoAxiom Branched)
- isOpenTypeFamilyTyCon :: TyCon -> Bool
- isDataFamilyTyCon :: TyCon -> Bool
- isTypeFamilyTyCon :: TyCon -> Bool
- isOpenFamilyTyCon :: TyCon -> Bool
- isFamilyTyCon :: TyCon -> Bool
- isEnumerationTyCon :: TyCon -> Bool
- isGadtSyntaxTyCon :: TyCon -> Bool
- mustBeSaturated :: TyCon -> Bool
- isFamFreeTyCon :: TyCon -> Bool
- isTauTyCon :: TyCon -> Bool
- isTypeSynonymTyCon :: TyCon -> Bool
- isDataSumTyCon_maybe :: TyCon -> Maybe [DataCon]
- isDataProductTyCon_maybe :: TyCon -> Maybe DataCon
- isProductTyCon :: TyCon -> Bool
- unwrapNewTyConEtad_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched)
- unwrapNewTyCon_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched)
- isNewTyCon :: TyCon -> Bool
- isGenInjAlgRhs :: AlgTyConRhs -> Bool
- isGenerativeTyCon :: TyCon -> Role -> Bool
- isInjectiveTyCon :: TyCon -> Role -> Bool
- isDataTyCon :: TyCon -> Bool
- isVanillaAlgTyCon :: TyCon -> Bool
- isAlgTyCon :: TyCon -> Bool
- isUnliftedTyCon :: TyCon -> Bool
- isPrimTyCon :: TyCon -> Bool
- isAbstractTyCon :: TyCon -> Bool
- mkPromotedDataCon :: DataCon -> Name -> TyConRepName -> [TyConTyCoBinder] -> Kind -> [Role] -> RuntimeRepInfo -> TyCon
- mkFamilyTyCon :: Name -> [TyConBinder] -> Kind -> Maybe Name -> FamTyConFlav -> Maybe Class -> Injectivity -> TyCon
- mkSynonymTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Type -> Bool -> Bool -> TyCon
- mkLiftedPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon
- mkKindTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Name -> TyCon
- mkPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon
- noTcTyConScopedTyVars :: [(Name, TcTyVar)]
- mkTcTyCon :: Name -> [TyConBinder] -> Kind -> [(Name, TcTyVar)] -> Bool -> TyConFlavour -> TyCon
- mkSumTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> [TyVar] -> [DataCon] -> AlgTyConFlav -> TyCon
- mkTupleTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> DataCon -> TupleSort -> AlgTyConFlav -> TyCon
- mkClassTyCon :: Name -> [TyConBinder] -> [Role] -> AlgTyConRhs -> Class -> Name -> TyCon
- mkAlgTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Maybe CType -> [PredType] -> AlgTyConRhs -> AlgTyConFlav -> Bool -> TyCon
- mkFunTyCon :: Name -> [TyConBinder] -> Name -> TyCon
- lookupTyConFieldLabel :: FieldLabelString -> TyCon -> Maybe FieldLabel
- tyConFieldLabels :: TyCon -> [FieldLabel]
- primRepIsFloat :: PrimRep -> Maybe Bool
- primElemRepSizeB :: PrimElemRep -> Int
- primRepSizeB :: DynFlags -> PrimRep -> Int
- primRepsCompatible :: DynFlags -> [PrimRep] -> [PrimRep] -> Bool
- primRepCompatible :: DynFlags -> PrimRep -> PrimRep -> Bool
- isGcPtrRep :: PrimRep -> Bool
- isVoidRep :: PrimRep -> Bool
- tyConRepModOcc :: Module -> OccName -> (Module, OccName)
- mkPrelTyConRepName :: Name -> TyConRepName
- tyConRepName_maybe :: TyCon -> Maybe TyConRepName
- isNoParent :: AlgTyConFlav -> Bool
- visibleDataCons :: AlgTyConRhs -> [DataCon]
- mkDataTyConRhs :: [DataCon] -> AlgTyConRhs
- tyConVisibleTyVars :: TyCon -> [TyVar]
- tyConTyVarBinders :: [TyConBinder] -> [TyVarBinder]
- mkTyConKind :: [TyConBinder] -> Kind -> Kind
- isInvisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool
- isVisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool
- isNamedTyConBinder :: TyConBinder -> Bool
- tyConBndrVisArgFlag :: TyConBndrVis -> ArgFlag
- tyConBinderArgFlag :: TyConBinder -> ArgFlag
- mkRequiredTyConBinder :: TyCoVarSet -> TyVar -> TyConBinder
- mkNamedTyConBinders :: ArgFlag -> [TyVar] -> [TyConBinder]
- mkNamedTyConBinder :: ArgFlag -> TyVar -> TyConBinder
- mkAnonTyConBinders :: AnonArgFlag -> [TyVar] -> [TyConBinder]
- mkAnonTyConBinder :: AnonArgFlag -> TyVar -> TyConBinder
- type TyConBinder = VarBndr TyVar TyConBndrVis
- type TyConTyCoBinder = VarBndr TyCoVar TyConBndrVis
- data TyConBndrVis
- 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
- data RuntimeRepInfo
- = NoRRI
- | RuntimeRep ([Type] -> [PrimRep])
- | VecCount Int
- | VecElem PrimElemRep
- data AlgTyConFlav
- data Injectivity
- = NotInjective
- | Injective [Bool]
- data FamTyConFlav
- type TyConRepName = Name
- data PrimRep
- data PrimElemRep
- data TyConFlavour
- data RecTcChecker
- classTyCon :: Class -> TyCon
- className :: Class -> Name
- data Role
- data BuiltInSynFamily = BuiltInSynFamily {
- sfMatchFam :: [Type] -> Maybe (CoAxiomRule, [Type], Type)
- sfInteractTop :: [Type] -> Type -> [TypeEqn]
- sfInteractInert :: [Type] -> Type -> [Type] -> Type -> [TypeEqn]
- type TyVar = Var
- dATA_TYPE_EQUALITY :: Module
- gHC_TYPENATS :: Module
- lookupPackageName :: DynFlags -> PackageName -> Maybe ComponentId
- typeNatKind :: Kind
- data Type
- = TyVarTy Var
- | AppTy Type Type
- | TyConApp TyCon [KindOrType]
- | ForAllTy !TyCoVarBinder Type
- | FunTy { }
- | LitTy TyLit
- | CastTy Type KindCoercion
- | CoercionTy Coercion
- data TyLit = NumTyLit Integer
- mkInstTyTcOcc :: String -> OccSet -> OccName
- emptyOccSet :: OccSet
- mkTcOcc :: String -> OccName
- newtype PackageName = PackageName FastString
- fsToUnitId :: FastString -> UnitId
- mkModule :: UnitId -> ModuleName -> Module
- mkModuleName :: String -> ModuleName
- getKey :: Unique -> Int
- getUnique :: Uniquable a => a -> Unique
- ppr :: Outputable a => a -> SDoc
- data ModuleName
- fsLit :: String -> FastString
- unpackFS :: FastString -> String
- data FastString
- isTupleTyCon :: TyCon -> Bool
- isUnboxedTupleTyCon :: TyCon -> Bool
- isFunTyCon :: TyCon -> Bool
- data TyCon
- showSDocUnsafe :: SDoc -> String
- text :: String -> SDoc
- tracePlugin :: String -> TcPlugin -> TcPlugin
- lookupName :: Module -> OccName -> TcPluginM Name
- lookupModule :: ModuleName -> FastString -> TcPluginM Module
- evByFiat :: String -> Type -> Type -> EvTerm
- type IsBootInterface = Bool
- type HsModule' = HsModule GhcPs
- type ModuleUnit = UnitId
- type RawUnitId = FastString
- type Substitution = [(TcTyVar, TcType)]
- newtype TypeEq = TypeEq {}
- data TvSubst = TvSubst InScopeSet TvSubstEnv
- type PredTree = Pred
- pattern IsBoot :: IsBootInterface
- pattern NotBoot :: IsBootInterface
- emptyTvSubst :: TvSubst
- toTCv :: TvSubst -> TCvSubst
- substTy :: TvSubst -> Type -> Type
- unionTvSubst :: TvSubst -> TvSubst -> TvSubst
- fromTCv :: TCvSubst -> TvSubst
- promotedBoolTyCon :: TyCon
- viewFunTy :: Type -> Maybe (Type, Type)
- tcUnifyTy :: Type -> Type -> Maybe TvSubst
- getEqTyCon :: TcPluginM TyCon
- getEqWitnessTyCon :: TcPluginM TyCon
- decompFunTy :: Type -> [Type]
- isTrivial :: PredType -> Bool
- normaliseGivens :: [Ct] -> TcPluginM [Ct]
- subsCt :: Substitution -> Ct -> Ct
- subsType :: Substitution -> Type -> Type
- mkSubstitution :: [Ct] -> Substitution
- classifyPredType :: Type -> PredTree
- preloadedUnitsM :: TcPluginM [FastString]
- moduleUnit' :: Module -> ModuleUnit
- noExtField :: NoExtField
Documentation
Plugin
is the compiler plugin data type. Try to avoid
constructing one of these directly, and just modify some fields of
defaultPlugin
instead: this is to try and preserve source-code
compatibility when we add fields to this.
Nonetheless, this API is preliminary and highly likely to change in the future.
Plugin | |
|
:: TcTyMode | |
-> LHsType GhcRn | Function (for printing only) |
-> TcType | Function |
-> [LHsTypeArg GhcRn] | Args |
-> TcM (TcType, TcKind) | (f args, args, result kind) |
Apply a type of a given kind to a list of arguments. This instantiates
invisible parameters as necessary. Always consumes all the arguments,
using matchExpectedFunKind as necessary.
This takes an optional VarEnv Kind
which maps kind variables to kinds.-
These kinds should be used to instantiate invisible kind variables;
they come from an enclosing class for an associated type/data family.
tcInferApps also arranges to saturate any trailing invisible arguments of a type-family application, which is usually the right thing to do tcInferApps_nosat does not do this saturation; it is used only by ":kind" in GHCi
newFlexiTyVar :: Kind -> TcPluginM TcTyVar #
tcLookupClass :: Name -> TcPluginM Class #
tcLookupTyCon :: Name -> TcPluginM TyCon #
tcPluginTrace :: String -> SDoc -> TcPluginM () #
Output useful for debugging the compiler.
tcPluginIO :: IO a -> TcPluginM a #
Perform some IO, typically to interact with an external tool.
defaultPlugin :: Plugin #
Default plugin: does nothing at all, except for marking that safe
inference has failed unless -fplugin-trustworthy
is passed. For
compatibility reaso you should base all your plugin definitions on this
default value.
purePlugin :: [CommandLineOption] -> IO PluginRecompile #
TcPlugin | |
|
data TcPluginResult #
TcPluginContradiction [Ct] | The plugin found a contradiction. The returned constraints are removed from the inert set, and recorded as insoluble. |
TcPluginOk [(EvTerm, Ct)] [Ct] | The first field is for constraints that were solved. These are removed from the inert set, and the evidence for them is recorded. The second field contains new work, that should be processed by the constraint solver. |
typeNatTyCons :: [TyCon] #
isWanted :: CtEvidence -> Bool #
ctEvPred :: CtEvidence -> TcPredType #
ctEvidence :: Ct -> CtEvidence #
HscEnv is like Session
, except that some of the fields are immutable.
An HscEnv is used to compile a single module from plain Haskell source
code (after preprocessing) to either C, assembly or C--. It's also used
to store the dynamic linker state to allow for multiple linkers in the
same address space.
Things like the module graph don't change during a single compilation.
Historical note: "hsc" used to be the name of the compiler binary, when there was a separate driver and compiler. To compile a single module, the driver would invoke hsc on the source code... so nowadays we think of hsc as the layer of the compiler that deals with compiling a single module.
lookupTyCon :: MonadThings m => Name -> m TyCon #
Instances
Data EvTerm | |
Defined in TcEvidence gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> EvTerm -> c EvTerm # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c EvTerm # toConstr :: EvTerm -> Constr # dataTypeOf :: EvTerm -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c EvTerm) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EvTerm) # gmapT :: (forall b. Data b => b -> b) -> EvTerm -> EvTerm # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EvTerm -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EvTerm -> r # gmapQ :: (forall d. Data d => d -> u) -> EvTerm -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> EvTerm -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> EvTerm -> m EvTerm # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> EvTerm -> m EvTerm # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> EvTerm -> m EvTerm # | |
Outputable EvTerm | |
tcTyFamInsts :: Type -> [(TyCon, [Type])] #
Finds outermost type-family applications occurring in a type, after expanding synonyms. In the list (F, tys) that is returned we guarantee that tys matches F's arity. For example, given type family F a :: * -> * (arity 1) calling tcTyFamInsts on (Maybe (F Int Bool) will return (F, [Int]), not (F, [Int,Bool])
This is important for its use in deciding termination of type instances (see #11581). E.g. type instance G [Int] = ...(F Int type)... we don't need to take type into account when asking if the calls on the RHS are smaller than the LHS
eqTyConName :: Name #
A predicate in the solver. The solver tries to prove Wanted predicates from Given ones.
A choice of equality relation. This is separate from the type Role
because Phantom
does not define a (non-trivial) equality relation.
mkPrimEqPredRole :: Role -> Type -> Type -> PredType #
Makes a lifted equality predicate at the given role
typeKind :: HasDebugCallStack => Type -> Kind #
splitTyConApp :: Type -> (TyCon, [Type]) #
Attempts to tease a type apart into a type constructor and the application
of a number of arguments to that constructor. Panics if that is not possible.
See also splitTyConApp_maybe
tyConAppTyCon_maybe :: Type -> Maybe TyCon #
The same as fst . splitTyConApp
unionTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst #
Type & coercion substitution
The following invariants must hold of a TCvSubst
:
- The in-scope set is needed only to guide the generation of fresh uniques
- In particular, the kind of the type variables in the in-scope set is not relevant
- The substitution is only applied ONCE! This is because in general such application will not reach a fixed point.
Create the plain type constructor type which has been applied to no type arguments at all.
eqType :: Type -> Type -> Bool #
Type equality on source types. Does not look through newtypes
or
PredType
s, but it does look through type synonyms.
This first checks that the kinds of the types are equal and then
checks whether the types are equal, ignoring casts and coercions.
(The kind check is a recursive call, but since all kinds have type
Type
, there is no need to check the types of kinds.)
See also Note [Non-trivial definitional equality] in TyCoRep.
splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type]) #
Attempts to tease a type apart into a type constructor and the application of a number of arguments to that constructor
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]
checkRecTc :: RecTcChecker -> TyCon -> Maybe RecTcChecker #
setRecTcMaxBound :: Int -> RecTcChecker -> RecTcChecker #
Change the upper bound for the number of times a RecTcChecker
is allowed
to encounter each TyCon
.
The default upper bound (100) for the number of times a RecTcChecker
is
allowed to encounter each TyCon
.
Initialise a RecTcChecker
with defaultRecTcMaxBound
.
pprPromotionQuote :: TyCon -> SDoc #
tcFlavourIsOpen :: TyConFlavour -> Bool #
Is this flavour of TyCon
an open type family or a data family?
tyConFlavour :: TyCon -> TyConFlavour #
mkTyConTagMap :: TyCon -> NameEnv ConTag #
tyConRuntimeRepInfo :: TyCon -> RuntimeRepInfo #
Extract any RuntimeRepInfo
from this TyCon
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) #
isFamInstTyCon :: TyCon -> Bool #
Is this TyCon
that for a data family instance?
tyConClass_maybe :: TyCon -> Maybe Class #
If this TyCon
is that for a class instance, return the class it is for.
Otherwise returns Nothing
isClassTyCon :: TyCon -> Bool #
Is this TyCon
that for a class instance?
famTyConFlav_maybe :: TyCon -> Maybe FamTyConFlav #
Extract the flavour of a type family (with all the extra information that it carries)
synTyConRhs_maybe :: TyCon -> Maybe Type #
Extract the information pertaining to the right hand side of a type synonym
(type
) declaration.
synTyConDefn_maybe :: TyCon -> Maybe ([TyVar], Type) #
Extract the TyVar
s bound by a vanilla type synonym
and the corresponding (unsubstituted) right hand side.
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 ...
newTyConDataCon_maybe :: TyCon -> Maybe DataCon #
newTyConCo :: TyCon -> CoAxiom Unbranched #
newTyConCo_maybe :: TyCon -> Maybe (CoAxiom Unbranched) #
newTyConEtadRhs :: 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.
newTyConRhs :: TyCon -> ([TyVar], Type) #
tyConRoles :: TyCon -> [Role] #
Get the list of roles for the type parameters of a TyCon
tyConFamilyResVar_maybe :: TyCon -> Maybe Name #
Extract type variable naming the result of injective type family
algTyConRhs :: TyCon -> AlgTyConRhs #
Extract an AlgTyConRhs
with information about data constructors from an
algebraic or tuple TyCon
. Panics for any other sort of TyCon
tyConFamilySize :: TyCon -> Int #
tyConSingleDataCon :: TyCon -> 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
tyConDataCons_maybe :: TyCon -> Maybe [DataCon] #
tyConDataCons :: TyCon -> [DataCon] #
As tyConDataCons_maybe
, but returns the empty list of constructors if no
constructors could be found
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.
:: TyCon | |
-> [tyco] | Arguments to |
-> Maybe ([(TyVar, tyco)], Type, [tyco]) | Returns a |
Expand a type synonym application, if any
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)
setTcTyConKind :: TyCon -> Kind -> TyCon #
tyConCType_maybe :: TyCon -> Maybe CType #
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
dfun
does 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)
isLiftedTypeKindTyConName :: Name -> Bool #
isKindTyCon :: TyCon -> Bool #
Is this tycon really meant for use at the kind level? That is, should it be permitted without -XDataKinds?
isPromotedDataCon_maybe :: TyCon -> Maybe DataCon #
Retrieves the promoted DataCon if this is a PromotedDataCon;
isPromotedDataCon :: TyCon -> Bool #
Is this a PromotedDataCon?
isPromotedTupleTyCon :: TyCon -> Bool #
Is this the TyCon
for a promoted tuple?
isUnboxedSumTyCon :: TyCon -> Bool #
Is this the TyCon
for an unboxed sum?
isBoxedTupleTyCon :: TyCon -> Bool #
Is this the TyCon
for a boxed tuple?
tyConTuple_maybe :: TyCon -> Maybe TupleSort #
tyConFlavourAssoc_maybe :: TyConFlavour -> Maybe TyCon #
Get the enclosing class TyCon (if there is one) for the given TyConFlavour
tyConAssoc_maybe :: TyCon -> Maybe TyCon #
Get the enclosing class TyCon (if there is one) for the given TyCon.
isTyConAssoc :: TyCon -> Bool #
Is this TyCon for an associated type?
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.
isClosedSynFamilyTyConWithAxiom_maybe :: TyCon -> Maybe (CoAxiom Branched) #
Is this a non-empty closed type family? Returns Nothing
for
abstract or empty closed families.
isOpenTypeFamilyTyCon :: TyCon -> Bool #
Is this an open type family TyCon?
isDataFamilyTyCon :: TyCon -> Bool #
Is this a synonym TyCon
that can have may have further instances appear?
isTypeFamilyTyCon :: TyCon -> Bool #
Is this a synonym TyCon
that can have may have further instances appear?
isOpenFamilyTyCon :: TyCon -> Bool #
Is this a TyCon
, synonym or otherwise, that defines a family with
instances?
isFamilyTyCon :: TyCon -> Bool #
Is this a TyCon
, synonym or otherwise, that defines a family?
isEnumerationTyCon :: TyCon -> Bool #
Is this an algebraic TyCon
which is just an enumeration of values?
isGadtSyntaxTyCon :: TyCon -> Bool #
Is this an algebraic TyCon
declared with the GADT syntax?
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
isFamFreeTyCon :: TyCon -> Bool #
isTauTyCon :: TyCon -> Bool #
isTypeSynonymTyCon :: TyCon -> Bool #
Is this a TyCon
representing a regular H98 type synonym (type
)?
isDataSumTyCon_maybe :: TyCon -> Maybe [DataCon] #
isProductTyCon :: TyCon -> Bool #
unwrapNewTyConEtad_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched) #
unwrapNewTyCon_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched) #
isNewTyCon :: TyCon -> Bool #
Is this TyCon
that for a newtype
isGenInjAlgRhs :: AlgTyConRhs -> Bool #
Is this an AlgTyConRhs
of a TyCon
that is generative and injective
with respect to representational equality?
isGenerativeTyCon :: TyCon -> Role -> Bool #
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 equality] in TcCanonical
isInjectiveTyCon :: TyCon -> Role -> Bool #
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 equality] in TcCanonical
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 newtype
s, unboxed tuples, unboxed sums 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
isVanillaAlgTyCon :: TyCon -> Bool #
Returns True
for vanilla AlgTyCons -- that is, those created
with a data
or newtype
declaration.
isAlgTyCon :: TyCon -> Bool #
Returns True
if the supplied TyCon
resulted from either a
data
or newtype
declaration
isUnliftedTyCon :: TyCon -> Bool #
isPrimTyCon :: TyCon -> Bool #
Does this TyCon
represent something that cannot be defined in Haskell?
isAbstractTyCon :: TyCon -> Bool #
Test if the TyCon
is algebraic but abstract (invisible data constructors)
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
:: Name | |
-> [TyConBinder] | |
-> Kind | result kind |
-> Maybe Name | |
-> FamTyConFlav | |
-> Maybe Class | |
-> Injectivity | |
-> TyCon |
Create a type family TyCon
Create a type synonym TyCon
:: Name | |
-> [TyConBinder] | |
-> Kind | result kind |
-> [Role] | |
-> TyCon |
Create a lifted primitive TyCon
such as RealWorld
Kind constructors
:: Name | |
-> [TyConBinder] | |
-> Kind | result kind, never levity-polymorphic |
-> [Role] | |
-> TyCon |
Create an unlifted primitive TyCon
, such as Int#
.
noTcTyConScopedTyVars :: [(Name, TcTyVar)] #
No scoped type variables (to be used with mkTcTyCon).
:: Name | |
-> [TyConBinder] | |
-> Kind | result kind only |
-> [(Name, TcTyVar)] | Scoped type variables; see Note [How TcTyCons work] in TcTyClsDecls |
-> 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 TcTyClsDecls.
:: Name | |
-> [TyConBinder] | |
-> Kind | Kind of the resulting |
-> Arity | Arity of the sum |
-> [TyVar] |
|
-> [DataCon] | |
-> AlgTyConFlav | |
-> TyCon |
:: Name | |
-> [TyConBinder] | |
-> Kind | Result kind of the |
-> Arity | Arity of the tuple |
-> DataCon | |
-> TupleSort | Whether the tuple is boxed or unboxed |
-> AlgTyConFlav | |
-> TyCon |
mkClassTyCon :: Name -> [TyConBinder] -> [Role] -> AlgTyConRhs -> Class -> Name -> TyCon #
Simpler specialization of mkAlgTyCon
for classes
:: 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)
mkFunTyCon :: Name -> [TyConBinder] -> Name -> TyCon #
lookupTyConFieldLabel :: FieldLabelString -> TyCon -> Maybe FieldLabel #
Look up a field label belonging to this TyCon
tyConFieldLabels :: TyCon -> [FieldLabel] #
The labels for the fields of this particular TyCon
primRepIsFloat :: PrimRep -> Maybe Bool #
Return if Rep stands for floating type, returns Nothing for vector types.
primElemRepSizeB :: PrimElemRep -> Int #
primRepSizeB :: DynFlags -> 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
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
layed out.
isGcPtrRep :: PrimRep -> Bool #
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 TcTypeable
in TcTypeable.
mkPrelTyConRepName :: Name -> TyConRepName #
Make a Name
for the Typeable
representation of the given wired-in type
isNoParent :: AlgTyConFlav -> Bool #
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 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!
mkDataTyConRhs :: [DataCon] -> AlgTyConRhs #
tyConVisibleTyVars :: TyCon -> [TyVar] #
tyConTyVarBinders :: [TyConBinder] -> [TyVarBinder] #
mkTyConKind :: [TyConBinder] -> Kind -> Kind #
isInvisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool #
isVisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool #
isNamedTyConBinder :: TyConBinder -> Bool #
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
mkNamedTyConBinders :: ArgFlag -> [TyVar] -> [TyConBinder] #
mkNamedTyConBinder :: ArgFlag -> TyVar -> TyConBinder #
mkAnonTyConBinders :: AnonArgFlag -> [TyVar] -> [TyConBinder] #
mkAnonTyConBinder :: AnonArgFlag -> TyVar -> TyConBinder #
type TyConBinder = VarBndr TyVar TyConBndrVis #
type TyConTyCoBinder = VarBndr TyCoVar TyConBndrVis #
data TyConBndrVis #
Instances
Binary TyConBndrVis | |
Defined in TyCon put_ :: BinHandle -> TyConBndrVis -> IO () # put :: BinHandle -> TyConBndrVis -> IO (Bin TyConBndrVis) # get :: BinHandle -> IO TyConBndrVis # | |
Outputable TyConBndrVis | |
Defined in TyCon ppr :: TyConBndrVis -> SDoc # pprPrec :: Rational -> TyConBndrVis -> SDoc # | |
OutputableBndr tv => Outputable (VarBndr tv TyConBndrVis) | |
data AlgTyConRhs #
Represents right-hand-sides of TyCon
s for algebraic types
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 |
| |
TupleTyCon | |
SumTyCon | An unboxed sum type. |
| |
NewTyCon | Information about those |
|
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 RepType
NoRRI | an ordinary promoted data con |
RuntimeRep ([Type] -> [PrimRep]) | A constructor of |
VecCount Int | A constructor of |
VecElem PrimElemRep | A constructor of |
data AlgTyConFlav #
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 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 |
Instances
Outputable AlgTyConFlav | |
Defined in TyCon ppr :: AlgTyConFlav -> SDoc # pprPrec :: Rational -> AlgTyConFlav -> SDoc # |
data Injectivity #
Instances
Eq Injectivity | |
Defined in TyCon (==) :: Injectivity -> Injectivity -> Bool # (/=) :: Injectivity -> Injectivity -> Bool # | |
Binary Injectivity | |
Defined in TyCon put_ :: BinHandle -> Injectivity -> IO () # put :: BinHandle -> Injectivity -> IO (Bin Injectivity) # get :: BinHandle -> IO Injectivity # |
data FamTyConFlav #
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 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 TyCon ppr :: FamTyConFlav -> SDoc # pprPrec :: Rational -> FamTyConFlav -> SDoc # |
type TyConRepName = Name #
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 RepType
and Note [VoidRep] in RepType.
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 #
Int8ElemRep | |
Int16ElemRep | |
Int32ElemRep | |
Int64ElemRep | |
Word8ElemRep | |
Word16ElemRep | |
Word32ElemRep | |
Word64ElemRep | |
FloatElemRep | |
DoubleElemRep |
Instances
Eq PrimElemRep | |
Defined in TyCon (==) :: PrimElemRep -> PrimElemRep -> Bool # (/=) :: PrimElemRep -> PrimElemRep -> Bool # | |
Show PrimElemRep | |
Defined in TyCon showsPrec :: Int -> PrimElemRep -> ShowS # show :: PrimElemRep -> String # showList :: [PrimElemRep] -> ShowS # | |
Outputable PrimElemRep | |
Defined in TyCon ppr :: PrimElemRep -> SDoc # pprPrec :: Rational -> PrimElemRep -> SDoc # |
data TyConFlavour #
Paints a picture of what a TyCon
represents, in broad strokes.
This is used towards more informative error messages.
Instances
Eq TyConFlavour | |
Defined in TyCon (==) :: TyConFlavour -> TyConFlavour -> Bool # (/=) :: TyConFlavour -> TyConFlavour -> Bool # | |
Outputable TyConFlavour | |
Defined in TyCon ppr :: TyConFlavour -> SDoc # pprPrec :: Rational -> TyConFlavour -> SDoc # |
data RecTcChecker #
classTyCon :: Class -> TyCon #
Instances
Eq Role | |
Data Role | |
Defined in CoAxiom gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Role -> c Role # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Role # dataTypeOf :: Role -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Role) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Role) # gmapT :: (forall b. Data b => b -> b) -> Role -> Role # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r # gmapQ :: (forall d. Data d => d -> u) -> Role -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Role -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Role -> m Role # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role # | |
Ord Role | |
Binary Role | |
Outputable Role | |
data BuiltInSynFamily #
BuiltInSynFamily | |
|
gHC_TYPENATS :: Module #
lookupPackageName :: DynFlags -> PackageName -> Maybe ComponentId #
Find the package we know about with the given package name (e.g. foo
), if any
(NB: there might be a locally defined unit name which overrides this)
typeNatKind :: Kind #
TyVarTy Var | Vanilla type or kind variable (*never* a coercion variable) |
AppTy Type Type | Type application to something other than a 1) Function: must not be a 2) Argument type |
TyConApp TyCon [KindOrType] | Application of a 1) Type constructor being applied to. 2) Type arguments. Might not have enough type arguments here to saturate the constructor. Even type synonyms are not necessarily saturated; for example unsaturated type synonyms can appear as the right hand side of a type synonym. |
ForAllTy !TyCoVarBinder Type | A Π type. |
FunTy | t1 -> t2 Very common, so an important special case See Note [Function types] |
LitTy TyLit | Type literals are similar to type constructors. |
CastTy Type KindCoercion | A kind cast. The coercion is always nominal. INVARIANT: The cast is never refl. INVARIANT: The Type is not a CastTy (use TransCo instead) See Note Respecting definitional equality and (EQ3) |
CoercionTy Coercion | Injection of a Coercion into a type This should only ever be used in the RHS of an AppTy, in the list of a TyConApp, when applying a promoted GADT data constructor |
Instances
Data Type | |
Defined in TyCoRep gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Type -> c Type # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Type # dataTypeOf :: Type -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Type) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type) # gmapT :: (forall b. Data b => b -> b) -> Type -> Type # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r # gmapQ :: (forall d. Data d => d -> u) -> Type -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Type -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Type -> m Type # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type # | |
Outputable Type | |
Instances
Eq TyLit | |
Data TyLit | |
Defined in TyCoRep gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TyLit -> c TyLit # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TyLit # dataTypeOf :: TyLit -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TyLit) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TyLit) # gmapT :: (forall b. Data b => b -> b) -> TyLit -> TyLit # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TyLit -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TyLit -> r # gmapQ :: (forall d. Data d => d -> u) -> TyLit -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TyLit -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TyLit -> m TyLit # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TyLit -> m TyLit # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TyLit -> m TyLit # | |
Ord TyLit | |
Outputable TyLit | |
Derive a name for the representation type constructor of a
data
/newtype
instance.
emptyOccSet :: OccSet #
newtype PackageName #
Instances
Eq PackageName | |
Defined in PackageConfig (==) :: PackageName -> PackageName -> Bool # (/=) :: PackageName -> PackageName -> Bool # | |
Ord PackageName | |
Defined in PackageConfig compare :: PackageName -> PackageName -> Ordering # (<) :: PackageName -> PackageName -> Bool # (<=) :: PackageName -> PackageName -> Bool # (>) :: PackageName -> PackageName -> Bool # (>=) :: PackageName -> PackageName -> Bool # max :: PackageName -> PackageName -> PackageName # min :: PackageName -> PackageName -> PackageName # | |
Uniquable PackageName | |
Defined in PackageConfig getUnique :: PackageName -> Unique # | |
Outputable PackageName | |
Defined in PackageConfig ppr :: PackageName -> SDoc # pprPrec :: Rational -> PackageName -> SDoc # | |
BinaryStringRep PackageName | |
Defined in PackageConfig fromStringRep :: ByteString -> PackageName # toStringRep :: PackageName -> ByteString # |
fsToUnitId :: FastString -> UnitId #
Create a new simple unit identifier from a FastString
. Internally,
this is primarily used to specify wired-in unit identifiers.
mkModule :: UnitId -> ModuleName -> Module #
mkModuleName :: String -> ModuleName #
ppr :: Outputable a => a -> SDoc #
data ModuleName #
A ModuleName is essentially a simple string, e.g. Data.List
.
Instances
fsLit :: String -> FastString #
unpackFS :: FastString -> String #
Unpacks and decodes the FastString
data FastString #
A FastString
is a UTF-8 encoded string together with a unique ID. All
FastString
s are stored in a global hashtable to support fast O(1)
comparison.
It is also associated with a lazy reference to the Z-encoding of this string which is used by the compiler internally.
Instances
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?
isFunTyCon :: TyCon -> Bool #
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
Eq TyCon | |
Data TyCon | |
Defined in TyCon gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TyCon -> c TyCon # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TyCon # dataTypeOf :: TyCon -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TyCon) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TyCon) # gmapT :: (forall b. Data b => b -> b) -> TyCon -> TyCon # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TyCon -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TyCon -> r # gmapQ :: (forall d. Data d => d -> u) -> TyCon -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TyCon -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TyCon -> m TyCon # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TyCon -> m TyCon # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TyCon -> m TyCon # | |
NamedThing TyCon | |
Uniquable TyCon | |
Outputable TyCon | |
showSDocUnsafe :: SDoc -> String #
tracePlugin :: String -> TcPlugin -> TcPlugin #
Print out extra information about the initialisation, stop, and every run
of the plugin when -ddump-tc-trace
is enabled.
:: ModuleName | Name of the module |
-> FastString | Name of the package containing the module. NOTE: This value is ignored on ghc>=8.0. |
-> TcPluginM Module |
Find a module
:: String | Name the coercion should have |
-> Type | The LHS of the equivalence relation (~) |
-> Type | The RHS of the equivalence relation (~) |
-> EvTerm |
The EvTerm
equivalent for unsafeCoerce
type IsBootInterface = Bool Source #
type ModuleUnit = UnitId Source #
type RawUnitId = FastString Source #
type Substitution = [(TcTyVar, TcType)] Source #
pattern IsBoot :: IsBootInterface Source #
pattern NotBoot :: IsBootInterface Source #
decompFunTy :: Type -> [Type] Source #
mkSubstitution :: [Ct] -> Substitution Source #
classifyPredType :: Type -> PredTree Source #
moduleUnit' :: Module -> ModuleUnit Source #