TcType

ghc-8.0.2: The GHC API

Safe Haskell | None
Language | Haskell2010

TcType

Contents

- Finding type instances
- Finding "exact" (non-dead) type variables
- Extracting bound variables

Synopsis

- type TcType = Type
- type TcSigmaType = TcType
- type TcRhoType = TcType
- type TcTauType = TcType
- type TcPredType = PredType
- type TcThetaType = ThetaType
- type TcTyVar = TyVar
- type TcTyVarSet = TyVarSet
- type TcDTyVarSet = DTyVarSet
- type TcTyCoVarSet = TyCoVarSet
- type TcDTyCoVarSet = DTyCoVarSet
- type TcKind = Kind
- type TcCoVar = CoVar
- type TcTyCoVar = Var
- type TcTyBinder = TyBinder
- type TcTyCon = TyCon
- tcSplitMethodTy :: Type -> ([TyVar], PredType, Type)
- data ExpType
  - = Check TcType
  - | Infer Unique TcLevel Kind (IORef (Maybe TcType))
- type ExpSigmaType = ExpType
- type ExpRhoType = ExpType
- mkCheckExpType :: TcType -> ExpType
- data SyntaxOpType
  - = SynAny
  - | SynRho
  - | SynList
  - | SynFun SyntaxOpType SyntaxOpType
  - | SynType ExpType
- synKnownType :: TcType -> SyntaxOpType
- mkSynFunTys :: [SyntaxOpType] -> ExpType -> SyntaxOpType
- newtype TcLevel = TcLevel Int
- topTcLevel :: TcLevel
- pushTcLevel :: TcLevel -> TcLevel
- isTopTcLevel :: TcLevel -> Bool
- strictlyDeeperThan :: TcLevel -> TcLevel -> Bool
- sameDepthAs :: TcLevel -> TcLevel -> Bool
- fmvTcLevel :: TcLevel -> TcLevel
- data UserTypeCtxt
  - = FunSigCtxt Name Bool
  - | InfSigCtxt Name
  - | ExprSigCtxt
  - | TypeAppCtxt
  - | ConArgCtxt Name
  - | TySynCtxt Name
  - | PatSynBuilderCtxt Name
  - | PatSigCtxt
  - | RuleSigCtxt Name
  - | ResSigCtxt
  - | ForSigCtxt Name
  - | DefaultDeclCtxt
  - | InstDeclCtxt
  - | SpecInstCtxt
  - | ThBrackCtxt
  - | GenSigCtxt
  - | GhciCtxt
  - | ClassSCCtxt Name
  - | SigmaCtxt
  - | DataTyCtxt Name
- pprUserTypeCtxt :: UserTypeCtxt -> SDoc
- pprSigCtxt :: UserTypeCtxt -> SDoc -> SDoc -> SDoc
- isSigMaybe :: UserTypeCtxt -> Maybe Name
- data TcTyVarDetails
  - = SkolemTv Bool
  - | FlatSkol TcType
  - | RuntimeUnk
  - | MetaTv {
    - mtv_info :: MetaInfo
    - mtv_ref :: IORef MetaDetails
    - mtv_tclvl :: TcLevel
    }
- pprTcTyVarDetails :: TcTyVarDetails -> SDoc
- vanillaSkolemTv :: TcTyVarDetails
- superSkolemTv :: TcTyVarDetails
- data MetaDetails
  - = Flexi
  - | Indirect TcType
- data MetaInfo
  - = TauTv
  - | SigTv
  - | FlatMetaTv
- data TauTvFlavour
  - = VanillaTau
  - | WildcardTau
- isImmutableTyVar :: TyVar -> Bool
- isSkolemTyVar :: TcTyVar -> Bool
- isMetaTyVar :: TcTyVar -> Bool
- isMetaTyVarTy :: TcType -> Bool
- isTyVarTy :: Type -> Bool
- isSigTyVar :: Var -> Bool
- isOverlappableTyVar :: TcTyVar -> Bool
- isTyConableTyVar :: TcTyVar -> Bool
- isFskTyVar :: TcTyVar -> Bool
- isFmvTyVar :: TcTyVar -> Bool
- isFlattenTyVar :: TcTyVar -> Bool
- isAmbiguousTyVar :: TcTyVar -> Bool
- metaTvRef :: TyVar -> IORef MetaDetails
- metaTyVarInfo :: TcTyVar -> MetaInfo
- isFlexi :: MetaDetails -> Bool
- isIndirect :: MetaDetails -> Bool
- isRuntimeUnkSkol :: TyVar -> Bool
- metaTyVarTcLevel :: TcTyVar -> TcLevel
- setMetaTyVarTcLevel :: TcTyVar -> TcLevel -> TcTyVar
- metaTyVarTcLevel_maybe :: TcTyVar -> Maybe TcLevel
- isTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool
- isTouchableOrFmv :: TcLevel -> TcTyVar -> Bool
- isFloatedTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool
- canUnifyWithPolyType :: DynFlags -> TcTyVarDetails -> Bool
- mkPhiTy :: [PredType] -> Type -> Type
- mkInvSigmaTy :: [TyVar] -> [PredType] -> Type -> Type
- mkSpecSigmaTy :: [TyVar] -> [PredType] -> Type -> Type
- mkSigmaTy :: [TyBinder] -> [PredType] -> Type -> Type
- mkNakedTyConApp :: TyCon -> [Type] -> Type
- mkNakedAppTys :: Type -> [Type] -> Type
- mkNakedAppTy :: Type -> Type -> Type
- mkNakedCastTy :: Type -> Coercion -> Type
- getTyVar :: String -> Type -> TyVar
- tcSplitForAllTy_maybe :: Type -> Maybe (TyBinder, Type)
- tcSplitForAllTys :: Type -> ([TyVar], Type)
- tcSplitPiTys :: Type -> ([TyBinder], Type)
- tcSplitNamedPiTys :: Type -> ([TyBinder], Type)
- tcSplitPhiTy :: Type -> (ThetaType, Type)
- tcSplitPredFunTy_maybe :: Type -> Maybe (PredType, Type)
- tcSplitFunTy_maybe :: Type -> Maybe (Type, Type)
- tcSplitFunTys :: Type -> ([Type], Type)
- tcFunArgTy :: Type -> Type
- tcFunResultTy :: Type -> Type
- tcSplitFunTysN :: TcRhoType -> Arity -> ([TcSigmaType], TcSigmaType)
- tcSplitTyConApp :: Type -> (TyCon, [Type])
- tcSplitTyConApp_maybe :: Type -> Maybe (TyCon, [Type])
- tcRepSplitTyConApp_maybe :: Type -> Maybe (TyCon, [Type])
- tcTyConAppTyCon :: Type -> TyCon
- tcTyConAppArgs :: Type -> [Type]
- tcSplitAppTy_maybe :: Type -> Maybe (Type, Type)
- tcSplitAppTy :: Type -> (Type, Type)
- tcSplitAppTys :: Type -> (Type, [Type])
- tcRepSplitAppTy_maybe :: Type -> Maybe (Type, Type)
- tcGetTyVar_maybe :: Type -> Maybe TyVar
- tcGetTyVar :: String -> Type -> TyVar
- nextRole :: Type -> Role
- tcSplitSigmaTy :: Type -> ([TyVar], ThetaType, Type)
- tcDeepSplitSigmaTy_maybe :: TcSigmaType -> Maybe ([TcType], [TyVar], ThetaType, TcSigmaType)
- eqType :: Type -> Type -> Bool
- eqTypes :: [Type] -> [Type] -> Bool
- cmpType :: Type -> Type -> Ordering
- cmpTypes :: [Type] -> [Type] -> Ordering
- eqTypeX :: RnEnv2 -> Type -> Type -> Bool
- pickyEqType :: TcType -> TcType -> Bool
- tcEqType :: TcType -> TcType -> Bool
- tcEqKind :: TcKind -> TcKind -> Bool
- tcEqTypeNoKindCheck :: TcType -> TcType -> Bool
- tcEqTypeVis :: TcType -> TcType -> Maybe VisibilityFlag
- isSigmaTy :: TcType -> Bool
- isRhoTy :: TcType -> Bool
- isRhoExpTy :: ExpType -> Bool
- isOverloadedTy :: Type -> Bool
- isFloatingTy :: Type -> Bool
- isDoubleTy :: Type -> Bool
- isFloatTy :: Type -> Bool
- isIntTy :: Type -> Bool
- isWordTy :: Type -> Bool
- isStringTy :: Type -> Bool
- isIntegerTy :: Type -> Bool
- isBoolTy :: Type -> Bool
- isUnitTy :: Type -> Bool
- isCharTy :: Type -> Bool
- isCallStackTy :: Type -> Bool
- isCallStackPred :: PredType -> Maybe FastString
- isTauTy :: Type -> Bool
- isTauTyCon :: TyCon -> Bool
- tcIsTyVarTy :: Type -> Bool
- tcIsForAllTy :: Type -> Bool
- isPredTy :: Type -> Bool
- isTyVarClassPred :: PredType -> Bool
- isTyVarExposed :: TcTyVar -> TcType -> Bool
- isTyVarUnderDatatype :: TcTyVar -> TcType -> Bool
- checkValidClsArgs :: Bool -> Class -> [KindOrType] -> Bool
- hasTyVarHead :: Type -> Bool
- isRigidEqPred :: TcLevel -> PredTree -> Bool
- isRigidTy :: TcType -> Bool
- deNoteType :: Type -> Type
- occurCheckExpand :: DynFlags -> TcTyVar -> Type -> OccCheckResult Type
- data OccCheckResult a
  - = OC_OK a
  - | OC_Forall
  - | OC_Occurs
- occCheckExpand :: TcTyVar -> TcType -> Maybe TcType
- orphNamesOfType :: Type -> NameSet
- orphNamesOfCo :: Coercion -> NameSet
- orphNamesOfTypes :: [Type] -> NameSet
- orphNamesOfCoCon :: CoAxiom br -> NameSet
- getDFunTyKey :: Type -> OccName
- evVarPred_maybe :: EvVar -> Maybe PredType
- evVarPred :: EvVar -> PredType
- mkMinimalBySCs :: [PredType] -> [PredType]
- transSuperClasses :: PredType -> [PredType]
- pickQuantifiablePreds :: TyVarSet -> TcThetaType -> TcThetaType -> TcThetaType
- immSuperClasses :: Class -> [Type] -> [PredType]
- isImprovementPred :: PredType -> Bool
- tcTyFamInsts :: Type -> [(TyCon, [Type])]
- exactTyCoVarsOfType :: Type -> TyCoVarSet
- exactTyCoVarsOfTypes :: [Type] -> TyVarSet
- splitDepVarsOfType :: Type -> TcDepVars
- splitDepVarsOfTypes :: [Type] -> TcDepVars
- data TcDepVars = DV {
  - dv_kvs :: DTyCoVarSet
  - dv_tvs :: DTyVarSet
  }
- depVarsTyVars :: TcDepVars -> DTyVarSet
- allBoundVariables :: Type -> TyVarSet
- allBoundVariabless :: [Type] -> TyVarSet
- isFFIArgumentTy :: DynFlags -> Safety -> Type -> Validity
- isFFIImportResultTy :: DynFlags -> Type -> Validity
- isFFIExportResultTy :: Type -> Validity
- isFFIExternalTy :: Type -> Validity
- isFFIDynTy :: Type -> Type -> Validity
- isFFIPrimArgumentTy :: DynFlags -> Type -> Validity
- isFFIPrimResultTy :: DynFlags -> Type -> Validity
- isFFILabelTy :: Type -> Validity
- isFFITy :: Type -> Bool
- isFunPtrTy :: Type -> Bool
- tcSplitIOType_maybe :: Type -> Maybe (TyCon, Type)
- type Kind = Type
- typeKind :: Type -> Kind
- liftedTypeKind :: Kind
- constraintKind :: Kind
- isLiftedTypeKind :: Kind -> Bool
- isUnliftedTypeKind :: Kind -> Bool
- classifiesTypeWithValues :: Kind -> Bool
- data Type
- type PredType = Type
- type ThetaType = [PredType]
- data TyBinder
- data VisibilityFlag
  - = Visible
  - | Specified
  - | Invisible
- mkForAllTy :: TyBinder -> Type -> Type
- mkForAllTys :: [TyBinder] -> Type -> Type
- mkInvForAllTys :: [TyVar] -> Type -> Type
- mkSpecForAllTys :: [TyVar] -> Type -> Type
- mkNamedForAllTy :: TyVar -> VisibilityFlag -> Type -> Type
- mkFunTy :: Type -> Type -> Type
- mkFunTys :: [Type] -> Type -> Type
- mkTyConApp :: TyCon -> [Type] -> Type
- mkAppTy :: Type -> Type -> Type
- mkAppTys :: Type -> [Type] -> Type
- mkTyConTy :: TyCon -> Type
- mkTyVarTy :: TyVar -> Type
- mkTyVarTys :: [TyVar] -> [Type]
- mkNamedBinder :: VisibilityFlag -> Var -> TyBinder
- isClassPred :: PredType -> Bool
- isEqPred :: PredType -> Bool
- isNomEqPred :: PredType -> Bool
- isIPPred :: PredType -> Bool
- mkClassPred :: Class -> [Type] -> PredType
- isDictLikeTy :: Type -> Bool
- tcSplitDFunTy :: Type -> ([TyVar], [Type], Class, [Type])
- tcSplitDFunHead :: Type -> (Class, [Type])
- isRuntimeRepVar :: TyVar -> Bool
- isRuntimeRepPolymorphic :: Kind -> Bool
- isVisibleBinder :: TyBinder -> Bool
- isInvisibleBinder :: TyBinder -> Bool
- data TCvSubst = TCvSubst InScopeSet TvSubstEnv CvSubstEnv
- type TvSubstEnv = TyVarEnv Type
- emptyTCvSubst :: TCvSubst
- zipTvSubst :: [TyVar] -> [Type] -> TCvSubst
- mkTvSubstPrs :: [(TyVar, Type)] -> TCvSubst
- notElemTCvSubst :: Var -> TCvSubst -> Bool
- unionTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst
- getTvSubstEnv :: TCvSubst -> TvSubstEnv
- setTvSubstEnv :: TCvSubst -> TvSubstEnv -> TCvSubst
- getTCvInScope :: TCvSubst -> InScopeSet
- extendTCvInScope :: TCvSubst -> Var -> TCvSubst
- extendTCvInScopeList :: TCvSubst -> [Var] -> TCvSubst
- extendTCvInScopeSet :: TCvSubst -> VarSet -> TCvSubst
- extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst
- lookupTyVar :: TCvSubst -> TyVar -> Maybe Type
- extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst
- substTyVarBndr :: (?callStack :: CallStack) => TCvSubst -> TyVar -> (TCvSubst, TyVar)
- extendTvSubst :: TCvSubst -> TyVar -> Type -> TCvSubst
- isInScope :: Var -> TCvSubst -> Bool
- mkTCvSubst :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> TCvSubst
- mkTvSubst :: InScopeSet -> TvSubstEnv -> TCvSubst
- zipTyEnv :: [TyVar] -> [Type] -> TvSubstEnv
- zipCoEnv :: [CoVar] -> [Coercion] -> CvSubstEnv
- substTy :: (?callStack :: CallStack) => TCvSubst -> Type -> Type
- substTys :: (?callStack :: CallStack) => TCvSubst -> [Type] -> [Type]
- substTyWith :: (?callStack :: CallStack) => [TyVar] -> [Type] -> Type -> Type
- substTyWithCoVars :: [CoVar] -> [Coercion] -> Type -> Type
- substTyAddInScope :: TCvSubst -> Type -> Type
- substTyUnchecked :: TCvSubst -> Type -> Type
- substTysUnchecked :: TCvSubst -> [Type] -> [Type]
- substThetaUnchecked :: TCvSubst -> ThetaType -> ThetaType
- substTyWithBindersUnchecked :: [TyBinder] -> [Type] -> Type -> Type
- substTyWithUnchecked :: [TyVar] -> [Type] -> Type -> Type
- substCoUnchecked :: TCvSubst -> Coercion -> Coercion
- substCoWithUnchecked :: [TyVar] -> [Type] -> Coercion -> Coercion
- substTheta :: (?callStack :: CallStack) => TCvSubst -> ThetaType -> ThetaType
- isUnliftedType :: Type -> Bool
- isUnboxedTupleType :: Type -> Bool
- isPrimitiveType :: Type -> Bool
- coreView :: Type -> Maybe Type
- tyCoVarsOfType :: Type -> TyCoVarSet
- tyCoVarsOfTypes :: [Type] -> TyCoVarSet
- closeOverKinds :: TyVarSet -> TyVarSet
- tyCoVarsOfTelescope :: [Var] -> TyCoVarSet -> TyCoVarSet
- tyCoFVsOfType :: Type -> FV
- tyCoFVsOfTypes :: [Type] -> FV
- tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet
- tyCoVarsOfTypesDSet :: [Type] -> DTyCoVarSet
- closeOverKindsDSet :: DTyVarSet -> DTyVarSet
- tyCoVarsOfTypeList :: Type -> [TyCoVar]
- tyCoVarsOfTypesList :: [Type] -> [TyCoVar]
- toTcType :: Type -> TcType
- toTcTypeBag :: Bag EvVar -> Bag EvVar
- pprKind :: Kind -> SDoc
- pprParendKind :: Kind -> SDoc
- pprSigmaType :: Type -> SDoc
- pprType :: Type -> SDoc
- pprParendType :: Type -> SDoc
- pprTypeApp :: TyCon -> [Type] -> SDoc
- pprTyThingCategory :: TyThing -> SDoc
- pprTheta :: ThetaType -> SDoc
- pprThetaArrowTy :: ThetaType -> SDoc
- pprClassPred :: Class -> [Type] -> SDoc
- pprTvBndr :: TyVar -> SDoc
- pprTvBndrs :: [TyVar] -> SDoc
- type TypeSize = IntWithInf
- sizeType :: Type -> TypeSize
- sizeTypes :: [Type] -> TypeSize
- toposortTyVars :: [TyVar] -> [TyVar]

# Documentation

type TcType = Type Source #

type TcSigmaType = TcType Source #

type TcRhoType = TcType Source #

type TcTauType = TcType Source #

type TcPredType = PredType Source #

type TcThetaType = ThetaType Source #

type TcTyVar = TyVar Source #

type TcTyVarSet = TyVarSet Source #

type TcDTyVarSet = DTyVarSet Source #

type TcTyCoVarSet = TyCoVarSet Source #

type TcDTyCoVarSet = DTyCoVarSet Source #

type TcKind = Kind Source #

type TcCoVar = CoVar Source #

type TcTyCoVar = Var Source #

type TcTyBinder = TyBinder Source #

type TcTyCon = TyCon Source #

tcSplitMethodTy :: Type -> ([TyVar], PredType, Type) Source #

data ExpType Source #

An expected type to check against during type-checking. See Note [ExpType] in TcMType, where you'll also find manipulators.

Constructors

Check TcType |
Infer Unique TcLevel Kind (IORef (Maybe TcType)) |

Instances

Outputable ExpType # |
Methods ppr :: ExpType -> SDoc Source # pprPrec :: Rational -> ExpType -> SDoc Source #

type ExpSigmaType = ExpType Source #

type ExpRhoType = ExpType Source #

mkCheckExpType :: TcType -> ExpType Source #

Make an `ExpType` suitable for checking.

data SyntaxOpType Source #

What to expect for an argument to a rebindable-syntax operator. Quite like `Type`, but allows for holes to be filled in by tcSyntaxOp. The callback called from tcSyntaxOp gets a list of types; the meaning of these types is determined by a left-to-right depth-first traversal of the `SyntaxOpType` tree. So if you pass in

    SynAny `SynFun` (SynList `SynFun` SynType Int) `SynFun` SynAny

you'll get three types back: one for the first `SynAny`, the element type of the list, and one for the last `SynAny`. You don't get anything for the `SynType`, because you've said positively that it should be an Int, and so it shall be.

This is defined here to avoid defining it in TcExpr.hs-boot.

Constructors

SynAny | Any type
SynRho | A rho type, deeply skolemised or instantiated as appropriate
SynList | A list type. You get back the element type of the list
SynFun SyntaxOpType SyntaxOpType infixr 0 | A function.
SynType ExpType | A known type.

synKnownType :: TcType -> SyntaxOpType Source #

Like `SynType` but accepts a regular TcType

mkSynFunTys :: [SyntaxOpType] -> ExpType -> SyntaxOpType Source #

Like `mkFunTys` but for `SyntaxOpType`

newtype TcLevel Source #

Constructors

TcLevel Int |

Instances

Eq TcLevel # |
Methods (==) :: TcLevel -> TcLevel -> Bool # (/=) :: TcLevel -> TcLevel -> Bool #
Ord TcLevel # |
Methods compare :: TcLevel -> TcLevel -> Ordering # (<) :: TcLevel -> TcLevel -> Bool # (<=) :: TcLevel -> TcLevel -> Bool # (>) :: TcLevel -> TcLevel -> Bool # (>=) :: TcLevel -> TcLevel -> Bool # max :: TcLevel -> TcLevel -> TcLevel # min :: TcLevel -> TcLevel -> TcLevel #
Outputable TcLevel # |
Methods ppr :: TcLevel -> SDoc Source # pprPrec :: Rational -> TcLevel -> SDoc Source #

topTcLevel :: TcLevel Source #

pushTcLevel :: TcLevel -> TcLevel Source #

isTopTcLevel :: TcLevel -> Bool Source #

strictlyDeeperThan :: TcLevel -> TcLevel -> Bool Source #

sameDepthAs :: TcLevel -> TcLevel -> Bool Source #

fmvTcLevel :: TcLevel -> TcLevel Source #

data UserTypeCtxt Source #

Constructors

FunSigCtxt Name Bool |
InfSigCtxt Name |
ExprSigCtxt |
TypeAppCtxt |
ConArgCtxt Name |
TySynCtxt Name |
PatSynBuilderCtxt Name |
PatSigCtxt |
RuleSigCtxt Name |
ResSigCtxt |
ForSigCtxt Name |
DefaultDeclCtxt |
InstDeclCtxt |
SpecInstCtxt |
ThBrackCtxt |
GenSigCtxt |
GhciCtxt |
ClassSCCtxt Name |
SigmaCtxt |
DataTyCtxt Name |

pprUserTypeCtxt :: UserTypeCtxt -> SDoc Source #

pprSigCtxt :: UserTypeCtxt -> SDoc -> SDoc -> SDoc Source #

isSigMaybe :: UserTypeCtxt -> Maybe Name Source #

data TcTyVarDetails Source #

Constructors

SkolemTv Bool |
FlatSkol TcType |
RuntimeUnk |
MetaTv |
Fields mtv_info :: MetaInfo mtv_ref :: IORef MetaDetails mtv_tclvl :: TcLevel

pprTcTyVarDetails :: TcTyVarDetails -> SDoc Source #

vanillaSkolemTv :: TcTyVarDetails Source #

superSkolemTv :: TcTyVarDetails Source #

data MetaDetails Source #

Constructors

Flexi |
Indirect TcType |

Instances

Outputable MetaDetails # |
Methods ppr :: MetaDetails -> SDoc Source # pprPrec :: Rational -> MetaDetails -> SDoc Source #

data MetaInfo Source #

Constructors

TauTv |
SigTv |
FlatMetaTv |

data TauTvFlavour Source #

Constructors

VanillaTau |
WildcardTau | A tyvar that originates from a type wildcard.

isImmutableTyVar :: TyVar -> Bool Source #

isSkolemTyVar :: TcTyVar -> Bool Source #

isMetaTyVar :: TcTyVar -> Bool Source #

isMetaTyVarTy :: TcType -> Bool Source #

isTyVarTy :: Type -> Bool Source #

isSigTyVar :: Var -> Bool Source #

isOverlappableTyVar :: TcTyVar -> Bool Source #

isTyConableTyVar :: TcTyVar -> Bool Source #

isFskTyVar :: TcTyVar -> Bool Source #

True of FlatSkol skolems only

isFmvTyVar :: TcTyVar -> Bool Source #

isFlattenTyVar :: TcTyVar -> Bool Source #

True of both given and wanted flatten-skolems (fak and usk)

isAmbiguousTyVar :: TcTyVar -> Bool Source #

metaTvRef :: TyVar -> IORef MetaDetails Source #

metaTyVarInfo :: TcTyVar -> MetaInfo Source #

isFlexi :: MetaDetails -> Bool Source #

isIndirect :: MetaDetails -> Bool Source #

isRuntimeUnkSkol :: TyVar -> Bool Source #

metaTyVarTcLevel :: TcTyVar -> TcLevel Source #

setMetaTyVarTcLevel :: TcTyVar -> TcLevel -> TcTyVar Source #

metaTyVarTcLevel_maybe :: TcTyVar -> Maybe TcLevel Source #

isTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool Source #

isTouchableOrFmv :: TcLevel -> TcTyVar -> Bool Source #

isFloatedTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool Source #

canUnifyWithPolyType :: DynFlags -> TcTyVarDetails -> Bool Source #

mkPhiTy :: [PredType] -> Type -> Type Source #

mkInvSigmaTy :: [TyVar] -> [PredType] -> Type -> Type Source #

mkSpecSigmaTy :: [TyVar] -> [PredType] -> Type -> Type Source #

Make a sigma ty where all type variables are "specified". That is, they can be used with visible type application

mkSigmaTy :: [TyBinder] -> [PredType] -> Type -> Type Source #

mkNakedTyConApp :: TyCon -> [Type] -> Type Source #

mkNakedAppTys :: Type -> [Type] -> Type Source #

mkNakedAppTy :: Type -> Type -> Type Source #

mkNakedCastTy :: Type -> Coercion -> Type Source #

getTyVar :: String -> Type -> TyVar Source #

Attempts to obtain the type variable underlying a `Type`, and panics with the given message if this is not a type variable type. See also `getTyVar_maybe`

tcSplitForAllTy_maybe :: Type -> Maybe (TyBinder, Type) Source #

tcSplitForAllTys :: Type -> ([TyVar], Type) Source #

Like `tcSplitPiTys`, but splits off only named binders, returning just the tycovars.

tcSplitPiTys :: Type -> ([TyBinder], Type) Source #

Splits a forall type into a list of `TyBinder`s and the inner type. Always succeeds, even if it returns an empty list.

tcSplitNamedPiTys :: Type -> ([TyBinder], Type) Source #

Like `tcSplitForAllTys`, but splits off only named binders.

tcSplitPhiTy :: Type -> (ThetaType, Type) Source #

tcSplitPredFunTy_maybe :: Type -> Maybe (PredType, Type) Source #

tcSplitFunTy_maybe :: Type -> Maybe (Type, Type) Source #

tcSplitFunTys :: Type -> ([Type], Type) Source #

tcFunArgTy :: Type -> Type Source #

tcFunResultTy :: Type -> Type Source #

tcSplitFunTysN :: TcRhoType -> Arity -> ([TcSigmaType], TcSigmaType) Source #

tcSplitTyConApp :: Type -> (TyCon, [Type]) Source #

tcSplitTyConApp_maybe :: Type -> Maybe (TyCon, [Type]) Source #

tcRepSplitTyConApp_maybe :: Type -> Maybe (TyCon, [Type]) Source #

tcTyConAppTyCon :: Type -> TyCon Source #

tcTyConAppArgs :: Type -> [Type] Source #

tcSplitAppTy_maybe :: Type -> Maybe (Type, Type) Source #

tcSplitAppTy :: Type -> (Type, Type) Source #

tcSplitAppTys :: Type -> (Type, [Type]) Source #

tcRepSplitAppTy_maybe :: Type -> Maybe (Type, Type) Source #

Does the AppTy split as in `tcSplitAppTy_maybe`, but assumes that any coreView stuff is already done. Refuses to look through (c => t)

tcGetTyVar_maybe :: Type -> Maybe TyVar Source #

tcGetTyVar :: String -> Type -> TyVar Source #

nextRole :: Type -> Role Source #

What is the role assigned to the next parameter of this type? Usually, this will be `Nominal`, but if the type is a `TyConApp`, we may be able to do better. The type does *not* have to be well-kinded when applied for this to work!

tcSplitSigmaTy :: Type -> ([TyVar], ThetaType, Type) Source #

Split a sigma type into its parts.

tcDeepSplitSigmaTy_maybe :: TcSigmaType -> Maybe ([TcType], [TyVar], ThetaType, TcSigmaType) Source #

eqType :: Type -> Type -> Bool Source #

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.

eqTypes :: [Type] -> [Type] -> Bool Source #

Type equality on lists of types, looking through type synonyms but not newtypes.

cmpType :: Type -> Type -> Ordering Source #

cmpTypes :: [Type] -> [Type] -> Ordering Source #

eqTypeX :: RnEnv2 -> Type -> Type -> Bool Source #

Compare types with respect to a (presumably) non-empty `RnEnv2`.

pickyEqType :: TcType -> TcType -> Bool Source #

Like `pickyEqTypeVis`, but returns a Bool for convenience

tcEqType :: TcType -> TcType -> Bool Source #

tcEqKind :: TcKind -> TcKind -> Bool Source #

tcEqTypeNoKindCheck :: TcType -> TcType -> Bool Source #

Just like `tcEqType`, but will return True for types of different kinds as long as their non-coercion structure is identical.

tcEqTypeVis :: TcType -> TcType -> Maybe VisibilityFlag Source #

Like `tcEqType`, but returns information about whether the difference is visible in the case of a mismatch. A return of Nothing means the types are `tcEqType`.

isSigmaTy :: TcType -> Bool Source #

isRhoTy :: TcType -> Bool Source #

isRhoExpTy :: ExpType -> Bool Source #

Like `isRhoTy`, but also says `True` for `Infer` types

isOverloadedTy :: Type -> Bool Source #

isFloatingTy :: Type -> Bool Source #

Does a type represent a floating-point number?

isDoubleTy :: Type -> Bool Source #

isFloatTy :: Type -> Bool Source #

isIntTy :: Type -> Bool Source #

isWordTy :: Type -> Bool Source #

isStringTy :: Type -> Bool Source #

Is a type `String`?

isIntegerTy :: Type -> Bool Source #

isBoolTy :: Type -> Bool Source #

isUnitTy :: Type -> Bool Source #

isCharTy :: Type -> Bool Source #

isCallStackTy :: Type -> Bool Source #

Is a type a `CallStack`?

isCallStackPred :: PredType -> Maybe FastString Source #

Is a `PredType` a `CallStack` implicit parameter?

If so, return the name of the parameter.

isTauTy :: Type -> Bool Source #

isTauTyCon :: TyCon -> Bool Source #

tcIsTyVarTy :: Type -> Bool Source #

tcIsForAllTy :: Type -> Bool Source #

Is this a ForAllTy with a named binder?

isPredTy :: Type -> Bool Source #

Is the type suitable to classify a given/wanted in the typechecker?

isTyVarClassPred :: PredType -> Bool Source #

isTyVarExposed :: TcTyVar -> TcType -> Bool Source #

Does the given tyvar appear in the given type outside of any non-newtypes? Assume we're looking for `a`. Says "yes" for `a`, `N a`, `b a`, `a b`, `b (N a)`. Says "no" for `[a]`, `Maybe a`, `T a`, where `N` is a newtype and `T` is a datatype.

isTyVarUnderDatatype :: TcTyVar -> TcType -> Bool Source #

Does the given tyvar appear under a type generative w.r.t. representational equality? See Note [Occurs check error] in TcCanonical for the motivation for this function.

checkValidClsArgs :: Bool -> Class -> [KindOrType] -> Bool Source #

hasTyVarHead :: Type -> Bool Source #

isRigidEqPred :: TcLevel -> PredTree -> Bool Source #

True of all Nominal equalities that are solidly insoluble This means all equalities *except* * Meta-tv non-SigTv on LHS * Meta-tv SigTv on LHS, tyvar on right

isRigidTy :: TcType -> Bool Source #

deNoteType :: Type -> Type Source #

occurCheckExpand :: DynFlags -> TcTyVar -> Type -> OccCheckResult Type Source #

data OccCheckResult a Source #

Constructors

OC_OK a |
OC_Forall |
OC_Occurs |

Instances

Monad OccCheckResult # |
Methods (>>=) :: OccCheckResult a -> (a -> OccCheckResult b) -> OccCheckResult b Source # (>>) :: OccCheckResult a -> OccCheckResult b -> OccCheckResult b Source # return :: a -> OccCheckResult a Source # fail :: String -> OccCheckResult a Source #
Functor OccCheckResult # |
Methods fmap :: (a -> b) -> OccCheckResult a -> OccCheckResult b Source # (<$) :: a -> OccCheckResult b -> OccCheckResult a Source #
Applicative OccCheckResult # |
Methods pure :: a -> OccCheckResult a Source # (<*>) :: OccCheckResult (a -> b) -> OccCheckResult a -> OccCheckResult b Source # (*>) :: OccCheckResult a -> OccCheckResult b -> OccCheckResult b Source # (<*) :: OccCheckResult a -> OccCheckResult b -> OccCheckResult a Source #

occCheckExpand :: TcTyVar -> TcType -> Maybe TcType Source #

orphNamesOfType :: Type -> NameSet Source #

orphNamesOfCo :: Coercion -> NameSet Source #

orphNamesOfTypes :: [Type] -> NameSet Source #

orphNamesOfCoCon :: CoAxiom br -> NameSet Source #

getDFunTyKey :: Type -> OccName Source #

evVarPred_maybe :: EvVar -> Maybe PredType Source #

evVarPred :: EvVar -> PredType Source #

mkMinimalBySCs :: [PredType] -> [PredType] Source #

transSuperClasses :: PredType -> [PredType] Source #

pickQuantifiablePreds :: TyVarSet -> TcThetaType -> TcThetaType -> TcThetaType Source #

When inferring types, should we quantify over a given predicate? Generally true of classes; generally false of equality constraints. Equality constraints that mention quantified type variables and implicit variables complicate the story. See Notes [Inheriting implicit parameters] and [Quantifying over equality constraints]

immSuperClasses :: Class -> [Type] -> [PredType] Source #

isImprovementPred :: PredType -> Bool Source #

# Finding type instances

tcTyFamInsts :: Type -> [(TyCon, [Type])] Source #

Finds outermost type-family applications occuring in a type, after expanding synonyms.

# Finding "exact" (non-dead) type variables

exactTyCoVarsOfType :: Type -> TyCoVarSet Source #

exactTyCoVarsOfTypes :: [Type] -> TyVarSet Source #

splitDepVarsOfType :: Type -> TcDepVars Source #

splitDepVarsOfTypes :: [Type] -> TcDepVars Source #

Like `splitDepVarsOfType`, but over a list of types

data TcDepVars Source #

Constructors

DV |
Fields dv_kvs :: DTyCoVarSet dv_tvs :: DTyVarSet

Instances

Outputable TcDepVars # |
Methods ppr :: TcDepVars -> SDoc Source # pprPrec :: Rational -> TcDepVars -> SDoc Source #

depVarsTyVars :: TcDepVars -> DTyVarSet Source #

# Extracting bound variables

allBoundVariables :: Type -> TyVarSet Source #

Find all variables bound anywhere in a type. See also Note [Scope-check inferred kinds] in TcHsType

allBoundVariabless :: [Type] -> TyVarSet Source #

isFFIArgumentTy :: DynFlags -> Safety -> Type -> Validity Source #

isFFIImportResultTy :: DynFlags -> Type -> Validity Source #

isFFIExportResultTy :: Type -> Validity Source #

isFFIExternalTy :: Type -> Validity Source #

isFFIDynTy :: Type -> Type -> Validity Source #

isFFIPrimArgumentTy :: DynFlags -> Type -> Validity Source #

isFFIPrimResultTy :: DynFlags -> Type -> Validity Source #

isFFILabelTy :: Type -> Validity Source #

isFFITy :: Type -> Bool Source #

isFunPtrTy :: Type -> Bool Source #

tcSplitIOType_maybe :: Type -> Maybe (TyCon, Type) Source #

type Kind = Type Source #

The key type representing kinds in the compiler.

typeKind :: Type -> Kind Source #

liftedTypeKind :: Kind Source #

constraintKind :: Kind Source #

isLiftedTypeKind :: Kind -> Bool Source #

This version considers Constraint to be distinct from *.

isUnliftedTypeKind :: Kind -> Bool Source #

classifiesTypeWithValues :: Kind -> Bool Source #

Does this classify a type allowed to have values? Responds True to things like *, #, TYPE Lifted, TYPE v, Constraint.

True of any sub-kind of OpenTypeKind

data Type Source #

The key representation of types within the compiler

Instances

Data Type # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Type -> c Type Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Type Source # toConstr :: Type -> Constr Source # dataTypeOf :: Type -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Type) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type) Source # gmapT :: (forall b. Data b => b -> b) -> Type -> Type Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Type -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Type -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Type -> m Type Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type Source #
Outputable Type # |
Methods ppr :: Type -> SDoc Source # pprPrec :: Rational -> Type -> SDoc Source #

type PredType = Type Source #

A type of the form `p` of kind `Constraint` represents a value whose type is the Haskell predicate `p`, where a predicate is what occurs before the `=>` in a Haskell type.

We use `PredType` as documentation to mark those types that we guarantee to have this kind.

It can be expanded into its representation, but:

- The type checker must treat it as opaque
- The rest of the compiler treats it as transparent

Consider these examples:

    f :: (Eq a) => a -> Int
    g :: (?x :: Int -> Int) => a -> Int
    h :: (r\l) => {r} => {l::Int | r}

Here the `Eq a` and `?x :: Int -> Int` and `rl` are all called "predicates"

type ThetaType = [PredType] Source #

A collection of `PredType`s

data TyBinder Source #

A `TyBinder` represents an argument to a function. TyBinders can be dependent (`Named`) or nondependent (`Anon`). They may also be visible or not. See also Note [TyBinder]

Instances

Data TyBinder # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TyBinder -> c TyBinder Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TyBinder Source # toConstr :: TyBinder -> Constr Source # dataTypeOf :: TyBinder -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c TyBinder) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TyBinder) Source # gmapT :: (forall b. Data b => b -> b) -> TyBinder -> TyBinder Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TyBinder -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TyBinder -> r Source # gmapQ :: (forall d. Data d => d -> u) -> TyBinder -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> TyBinder -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TyBinder -> m TyBinder Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TyBinder -> m TyBinder Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TyBinder -> m TyBinder Source #
Outputable TyBinder # |
Methods ppr :: TyBinder -> SDoc Source # pprPrec :: Rational -> TyBinder -> SDoc Source #

data VisibilityFlag Source #

Is something required to appear in source Haskell (`Visible`), permitted by request (`Specified`) (visible type application), or prohibited entirely from appearing in source Haskell (`Invisible`)? Examples in Note [VisibilityFlag]

Constructors

Visible |
Specified |
Invisible |

Instances

Eq VisibilityFlag # |
Methods (==) :: VisibilityFlag -> VisibilityFlag -> Bool # (/=) :: VisibilityFlag -> VisibilityFlag -> Bool #
Data VisibilityFlag # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> VisibilityFlag -> c VisibilityFlag Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c VisibilityFlag Source # toConstr :: VisibilityFlag -> Constr Source # dataTypeOf :: VisibilityFlag -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c VisibilityFlag) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VisibilityFlag) Source # gmapT :: (forall b. Data b => b -> b) -> VisibilityFlag -> VisibilityFlag Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> VisibilityFlag -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> VisibilityFlag -> r Source # gmapQ :: (forall d. Data d => d -> u) -> VisibilityFlag -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> VisibilityFlag -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> VisibilityFlag -> m VisibilityFlag Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> VisibilityFlag -> m VisibilityFlag Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> VisibilityFlag -> m VisibilityFlag Source #
Outputable VisibilityFlag # |
Methods ppr :: VisibilityFlag -> SDoc Source # pprPrec :: Rational -> VisibilityFlag -> SDoc Source #
Binary VisibilityFlag # |
Methods put_ :: BinHandle -> VisibilityFlag -> IO () Source # put :: BinHandle -> VisibilityFlag -> IO (Bin VisibilityFlag) Source # get :: BinHandle -> IO VisibilityFlag Source #

mkForAllTy :: TyBinder -> Type -> Type Source #

mkForAllTys :: [TyBinder] -> Type -> Type Source #

Wraps foralls over the type using the provided `TyVar`s from left to right

mkInvForAllTys :: [TyVar] -> Type -> Type Source #

Like mkForAllTys, but assumes all variables are dependent and invisible, a common case

mkSpecForAllTys :: [TyVar] -> Type -> Type Source #

Like mkForAllTys, but assumes all variables are dependent and specified, a common case

mkNamedForAllTy :: TyVar -> VisibilityFlag -> Type -> Type Source #

Make a dependent forall.

mkFunTy :: Type -> Type -> Type infixr 3 Source #

Make an arrow type

mkFunTys :: [Type] -> Type -> Type Source #

Make nested arrow types

mkTyConApp :: TyCon -> [Type] -> Type Source #

A key function: builds a `TyConApp` or `FunTy` as appropriate to its arguments. Applies its arguments to the constructor from left to right.

mkAppTy :: Type -> Type -> Type Source #

Applies a type to another, as in e.g. `k a`

mkAppTys :: Type -> [Type] -> Type Source #

mkTyConTy :: TyCon -> Type Source #

Create the plain type constructor type which has been applied to no type arguments at all.

mkTyVarTy :: TyVar -> Type Source #

mkTyVarTys :: [TyVar] -> [Type] Source #

mkNamedBinder :: VisibilityFlag -> Var -> TyBinder Source #

Make a named binder

isClassPred :: PredType -> Bool Source #

isEqPred :: PredType -> Bool Source #

isNomEqPred :: PredType -> Bool Source #

isIPPred :: PredType -> Bool Source #

mkClassPred :: Class -> [Type] -> PredType Source #

isDictLikeTy :: Type -> Bool Source #

tcSplitDFunTy :: Type -> ([TyVar], [Type], Class, [Type]) Source #

tcSplitDFunHead :: Type -> (Class, [Type]) Source #

isRuntimeRepVar :: TyVar -> Bool Source #

Is a tyvar of type `RuntimeRep`?

isRuntimeRepPolymorphic :: Kind -> Bool Source #

Tests whether the given type (which should look like "TYPE ...") has any free variables

isVisibleBinder :: TyBinder -> Bool Source #

Does this binder bind a visible argument?

isInvisibleBinder :: TyBinder -> Bool Source #

Does this binder bind an invisible argument?

data TCvSubst Source #

Type & coercion substitution

The following invariants must hold of a `TCvSubst`:

1. The in-scope set is needed only to guide the generation of fresh uniques
2. In particular, the kind of the type variables in the in-scope set is not relevant
3. The substitution is only applied ONCE! This is because in general such application will not reach a fixed point.

Constructors

TCvSubst InScopeSet TvSubstEnv CvSubstEnv |

Instances

Outputable TCvSubst # |
Methods ppr :: TCvSubst -> SDoc Source # pprPrec :: Rational -> TCvSubst -> SDoc Source #

type TvSubstEnv = TyVarEnv Type Source #

A substitution of `Type`s for `TyVar`s and `Kind`s for `KindVar`s

emptyTCvSubst :: TCvSubst Source #

zipTvSubst :: [TyVar] -> [Type] -> TCvSubst Source #

Generates the in-scope set for the `TCvSubst` from the types in the incoming environment. No CoVars, please!

mkTvSubstPrs :: [(TyVar, Type)] -> TCvSubst Source #

Generates the in-scope set for the `TCvSubst` from the types in the incoming environment. No CoVars, please!

notElemTCvSubst :: Var -> TCvSubst -> Bool Source #

unionTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst Source #

getTvSubstEnv :: TCvSubst -> TvSubstEnv Source #

setTvSubstEnv :: TCvSubst -> TvSubstEnv -> TCvSubst Source #

getTCvInScope :: TCvSubst -> InScopeSet Source #

extendTCvInScope :: TCvSubst -> Var -> TCvSubst Source #

extendTCvInScopeList :: TCvSubst -> [Var] -> TCvSubst Source #

extendTCvInScopeSet :: TCvSubst -> VarSet -> TCvSubst Source #

extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst Source #

lookupTyVar :: TCvSubst -> TyVar -> Maybe Type Source #

extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst Source #

substTyVarBndr :: (?callStack :: CallStack) => TCvSubst -> TyVar -> (TCvSubst, TyVar) Source #

extendTvSubst :: TCvSubst -> TyVar -> Type -> TCvSubst Source #

isInScope :: Var -> TCvSubst -> Bool Source #

mkTCvSubst :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> TCvSubst Source #

mkTvSubst :: InScopeSet -> TvSubstEnv -> TCvSubst Source #

Mkae a TCvSubst with specified tyvar subst and empty covar subst

zipTyEnv :: [TyVar] -> [Type] -> TvSubstEnv Source #

zipCoEnv :: [CoVar] -> [Coercion] -> CvSubstEnv Source #

substTy :: (?callStack :: CallStack) => TCvSubst -> Type -> Type Source #

Substitute within a `Type` The substitution has to satisfy the invariants described in Note [The substitution invariant].

substTys :: (?callStack :: CallStack) => TCvSubst -> [Type] -> [Type] Source #

Substitute within several `Type`s The substitution has to satisfy the invariants described in Note [The substitution invariant].

substTyWith :: (?callStack :: CallStack) => [TyVar] -> [Type] -> Type -> Type Source #

Type substitution, see `zipTvSubst`

substTyWithCoVars :: [CoVar] -> [Coercion] -> Type -> Type Source #

Substitute covars within a type

substTyAddInScope :: TCvSubst -> Type -> Type Source #

Substitute within a `Type` after adding the free variables of the type to the in-scope set. This is useful for the case when the free variables aren't already in the in-scope set or easily available. See also Note [The substitution invariant].

substTyUnchecked :: TCvSubst -> Type -> Type Source #

Substitute within a `Type` disabling the sanity checks. The problems that the sanity checks in substTy catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substTyUnchecked to substTy and remove this function. Please don't use in new code.

substTysUnchecked :: TCvSubst -> [Type] -> [Type] Source #

Substitute within several `Type`s disabling the sanity checks. The problems that the sanity checks in substTys catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substTysUnchecked to substTys and remove this function. Please don't use in new code.

substThetaUnchecked :: TCvSubst -> ThetaType -> ThetaType Source #

Substitute within a `ThetaType` disabling the sanity checks. The problems that the sanity checks in substTys catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substThetaUnchecked to substTheta and remove this function. Please don't use in new code.

substTyWithBindersUnchecked :: [TyBinder] -> [Type] -> Type -> Type Source #

Type substitution using `Binder`s disabling the sanity checks. Anonymous binders simply ignore their matching type. The problems that the sanity checks in substTy catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substTyUnchecked to substTy and remove this function. Please don't use in new code.

substTyWithUnchecked :: [TyVar] -> [Type] -> Type -> Type Source #

Type substitution, see `zipTvSubst`. Disables sanity checks. The problems that the sanity checks in substTy catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substTyUnchecked to substTy and remove this function. Please don't use in new code.

substCoUnchecked :: TCvSubst -> Coercion -> Coercion Source #

Substitute within a `Coercion` disabling sanity checks. The problems that the sanity checks in substCo catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substCoUnchecked to substCo and remove this function. Please don't use in new code.

substCoWithUnchecked :: [TyVar] -> [Type] -> Coercion -> Coercion Source #

Coercion substitution, see `zipTvSubst`. Disables sanity checks. The problems that the sanity checks in substCo catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substCoUnchecked to substCo and remove this function. Please don't use in new code.

substTheta :: (?callStack :: CallStack) => TCvSubst -> ThetaType -> ThetaType Source #

Substitute within a `ThetaType` The substitution has to satisfy the invariants described in Note [The substitution invariant].

isUnliftedType :: Type -> Bool Source #

See Type for what an unlifted type is

isUnboxedTupleType :: Type -> Bool Source #

isPrimitiveType :: Type -> Bool Source #

Returns true of types that are opaque to Haskell.

coreView :: Type -> Maybe Type Source #

This function Strips off the top layer only of a type synonym application (if any) its underlying representation type. Returns Nothing if there is nothing to look through.

By being non-recursive and inlined, this case analysis gets efficiently joined onto the case analysis that the caller is already doing

tyCoVarsOfType :: Type -> TyCoVarSet Source #

Returns free variables of a type, including kind variables as a non-deterministic set. For type synonyms it does not expand the synonym.

tyCoVarsOfTypes :: [Type] -> TyCoVarSet Source #

Returns free variables of types, including kind variables as a non-deterministic set. For type synonyms it does not expand the synonym.

closeOverKinds :: TyVarSet -> TyVarSet Source #

Add the kind variables free in the kinds of the tyvars in the given set. Returns a non-deterministic set.

tyCoVarsOfTelescope :: [Var] -> TyCoVarSet -> TyCoVarSet Source #

Gets the free vars of a telescope, scoped over a given free var set.

tyCoFVsOfType :: Type -> FV Source #

The worker for `tyVarsOfType` and `tyVarsOfTypeList`. The previous implementation used `unionVarSet` which is O(n+m) and can make the function quadratic. It's exported, so that it can be composed with other functions that compute free variables. See Note [FV naming conventions] in FV.

Eta-expanded because that makes it run faster (apparently)

tyCoFVsOfTypes :: [Type] -> FV Source #

tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet Source #

`tyVarsOfType` that returns free variables of a type in a deterministic set. For explanation of why using `VarSet` is not deterministic see Note [Deterministic FV] in FV.

tyCoVarsOfTypesDSet :: [Type] -> DTyCoVarSet Source #

Returns free variables of types, including kind variables as a deterministic set. For type synonyms it does not expand the synonym.

closeOverKindsDSet :: DTyVarSet -> DTyVarSet Source #

Add the kind variables free in the kinds of the tyvars in the given set. Returns a deterministic set.

tyCoVarsOfTypeList :: Type -> [TyCoVar] Source #

`tyVarsOfType` that returns free variables of a type in deterministic order. For explanation of why using `VarSet` is not deterministic see Note [Deterministic FV] in FV.

tyCoVarsOfTypesList :: [Type] -> [TyCoVar] Source #

Returns free variables of types, including kind variables as a deterministically ordered list. For type synonyms it does not expand the synonym.

toTcType :: Type -> TcType Source #

toTcTypeBag :: Bag EvVar -> Bag EvVar Source #

pprKind :: Kind -> SDoc Source #

pprParendKind :: Kind -> SDoc Source #

pprSigmaType :: Type -> SDoc Source #

pprType :: Type -> SDoc Source #

pprParendType :: Type -> SDoc Source #

pprTypeApp :: TyCon -> [Type] -> SDoc Source #

pprTyThingCategory :: TyThing -> SDoc Source #

pprTheta :: ThetaType -> SDoc Source #

pprThetaArrowTy :: ThetaType -> SDoc Source #

pprClassPred :: Class -> [Type] -> SDoc Source #

pprTvBndr :: TyVar -> SDoc Source #

pprTvBndrs :: [TyVar] -> SDoc Source #

type TypeSize = IntWithInf Source #

sizeType :: Type -> TypeSize Source #

sizeTypes :: [Type] -> TypeSize Source #

toposortTyVars :: [TyVar] -> [TyVar] Source #

Do a topological sort on a list of tyvars. This is a deterministic sorting operation (that is, doesn't depend on Uniques).