Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data TyThing
- tyThingCategory :: TyThing -> String
- pprTyThingCategory :: TyThing -> SDoc
- pprShortTyThing :: TyThing -> SDoc
- data Type
- data TyLit
- type KindOrType = Type
- type Kind = Type
- type KnotTied ty = ty
- type PredType = Type
- type ThetaType = [PredType]
- data ArgFlag
- data Coercion
- = Refl Type
- | GRefl Role Type MCoercionN
- | TyConAppCo Role TyCon [Coercion]
- | AppCo Coercion CoercionN
- | ForAllCo TyCoVar KindCoercion Coercion
- | FunCo Role Coercion Coercion
- | CoVarCo CoVar
- | AxiomInstCo (CoAxiom Branched) BranchIndex [Coercion]
- | AxiomRuleCo CoAxiomRule [Coercion]
- | UnivCo UnivCoProvenance Role Type Type
- | SymCo Coercion
- | TransCo Coercion Coercion
- | NthCo Role Int Coercion
- | LRCo LeftOrRight CoercionN
- | InstCo Coercion CoercionN
- | KindCo Coercion
- | SubCo CoercionN
- | HoleCo CoercionHole
- data UnivCoProvenance
- data CoercionHole = CoercionHole {}
- coHoleCoVar :: CoercionHole -> CoVar
- setCoHoleCoVar :: CoercionHole -> CoVar -> CoercionHole
- type CoercionN = Coercion
- type CoercionR = Coercion
- type CoercionP = Coercion
- type KindCoercion = CoercionN
- data MCoercion
- type MCoercionR = MCoercion
- type MCoercionN = MCoercion
- mkTyConTy :: TyCon -> Type
- mkTyVarTy :: TyVar -> Type
- mkTyVarTys :: [TyVar] -> [Type]
- mkTyCoVarTy :: TyCoVar -> Type
- mkTyCoVarTys :: [TyCoVar] -> [Type]
- mkFunTy :: Type -> Type -> Type
- mkFunTys :: [Type] -> Type -> Type
- mkTyCoForAllTy :: TyCoVar -> ArgFlag -> Type -> Type
- mkForAllTys :: [TyCoVarBinder] -> Type -> Type
- mkForAllTy :: TyCoVar -> ArgFlag -> Type -> Type
- mkTyCoPiTy :: TyCoBinder -> Type -> Type
- mkTyCoPiTys :: [TyCoBinder] -> Type -> Type
- mkPiTys :: [TyCoBinder] -> Type -> Type
- kindRep_maybe :: HasDebugCallStack => Kind -> Maybe Type
- kindRep :: HasDebugCallStack => Kind -> Type
- isLiftedTypeKind :: Kind -> Bool
- isUnliftedTypeKind :: Kind -> Bool
- isLiftedRuntimeRep :: Type -> Bool
- isUnliftedRuntimeRep :: Type -> Bool
- isRuntimeRepTy :: Type -> Bool
- isRuntimeRepVar :: TyVar -> Bool
- sameVis :: ArgFlag -> ArgFlag -> Bool
- data TyCoBinder
- type TyCoVarBinder = VarBndr TyCoVar ArgFlag
- type TyBinder = TyCoBinder
- binderVar :: VarBndr tv argf -> tv
- binderVars :: [VarBndr tv argf] -> [tv]
- binderType :: VarBndr TyCoVar argf -> Type
- binderArgFlag :: VarBndr tv argf -> argf
- delBinderVar :: VarSet -> TyCoVarBinder -> VarSet
- isInvisibleArgFlag :: ArgFlag -> Bool
- isVisibleArgFlag :: ArgFlag -> Bool
- isInvisibleBinder :: TyCoBinder -> Bool
- isVisibleBinder :: TyCoBinder -> Bool
- isTyBinder :: TyCoBinder -> Bool
- isNamedBinder :: TyCoBinder -> Bool
- tyCoBinderArgFlag :: TyCoBinder -> ArgFlag
- pickLR :: LeftOrRight -> (a, a) -> a
- pprType :: Type -> SDoc
- pprParendType :: Type -> SDoc
- pprPrecType :: PprPrec -> Type -> SDoc
- pprPrecTypeX :: TidyEnv -> PprPrec -> Type -> SDoc
- pprTypeApp :: TyCon -> [Type] -> SDoc
- pprTCvBndr :: TyCoVarBinder -> SDoc
- pprTCvBndrs :: [TyCoVarBinder] -> SDoc
- pprSigmaType :: Type -> SDoc
- pprTheta :: ThetaType -> SDoc
- pprParendTheta :: ThetaType -> SDoc
- pprForAll :: [TyCoVarBinder] -> SDoc
- pprUserForAll :: [TyCoVarBinder] -> SDoc
- pprTyVar :: TyVar -> SDoc
- pprTyVars :: [TyVar] -> SDoc
- pprThetaArrowTy :: ThetaType -> SDoc
- pprClassPred :: Class -> [Type] -> SDoc
- pprKind :: Kind -> SDoc
- pprParendKind :: Kind -> SDoc
- pprTyLit :: TyLit -> SDoc
- newtype PprPrec = PprPrec Int
- topPrec :: PprPrec
- sigPrec :: PprPrec
- opPrec :: PprPrec
- funPrec :: PprPrec
- appPrec :: PprPrec
- maybeParen :: PprPrec -> PprPrec -> SDoc -> SDoc
- pprDataCons :: TyCon -> SDoc
- pprWithExplicitKindsWhen :: Bool -> SDoc -> SDoc
- pprCo :: Coercion -> SDoc
- pprParendCo :: Coercion -> SDoc
- debugPprType :: Type -> SDoc
- tyCoVarsOfType :: Type -> TyCoVarSet
- tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet
- tyCoVarsOfTypes :: [Type] -> TyCoVarSet
- tyCoVarsOfTypesDSet :: [Type] -> DTyCoVarSet
- tyCoFVsBndr :: TyCoVarBinder -> FV -> FV
- tyCoFVsVarBndr :: Var -> FV -> FV
- tyCoFVsVarBndrs :: [Var] -> FV -> FV
- tyCoFVsOfType :: Type -> FV
- tyCoVarsOfTypeList :: Type -> [TyCoVar]
- tyCoFVsOfTypes :: [Type] -> FV
- tyCoVarsOfTypesList :: [Type] -> [TyCoVar]
- coVarsOfType :: Type -> CoVarSet
- coVarsOfTypes :: [Type] -> TyCoVarSet
- coVarsOfCo :: Coercion -> CoVarSet
- coVarsOfCos :: [Coercion] -> CoVarSet
- tyCoVarsOfCo :: Coercion -> TyCoVarSet
- tyCoVarsOfCos :: [Coercion] -> TyCoVarSet
- tyCoVarsOfCoDSet :: Coercion -> DTyCoVarSet
- tyCoFVsOfCo :: Coercion -> FV
- tyCoFVsOfCos :: [Coercion] -> FV
- tyCoVarsOfCoList :: Coercion -> [TyCoVar]
- tyCoVarsOfProv :: UnivCoProvenance -> TyCoVarSet
- almostDevoidCoVarOfCo :: CoVar -> Coercion -> Bool
- injectiveVarsOfBinder :: TyConBinder -> FV
- injectiveVarsOfType :: Type -> FV
- noFreeVarsOfType :: Type -> Bool
- noFreeVarsOfCo :: Coercion -> Bool
- data TCvSubst = TCvSubst InScopeSet TvSubstEnv CvSubstEnv
- type TvSubstEnv = TyVarEnv Type
- type CvSubstEnv = CoVarEnv Coercion
- emptyTvSubstEnv :: TvSubstEnv
- emptyCvSubstEnv :: CvSubstEnv
- composeTCvSubstEnv :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> (TvSubstEnv, CvSubstEnv) -> (TvSubstEnv, CvSubstEnv)
- composeTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst
- emptyTCvSubst :: TCvSubst
- mkEmptyTCvSubst :: InScopeSet -> TCvSubst
- isEmptyTCvSubst :: TCvSubst -> Bool
- mkTCvSubst :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> TCvSubst
- mkTvSubst :: InScopeSet -> TvSubstEnv -> TCvSubst
- mkCvSubst :: InScopeSet -> CvSubstEnv -> TCvSubst
- getTvSubstEnv :: TCvSubst -> TvSubstEnv
- getCvSubstEnv :: TCvSubst -> CvSubstEnv
- getTCvInScope :: TCvSubst -> InScopeSet
- getTCvSubstRangeFVs :: TCvSubst -> VarSet
- isInScope :: Var -> TCvSubst -> Bool
- notElemTCvSubst :: Var -> TCvSubst -> Bool
- setTvSubstEnv :: TCvSubst -> TvSubstEnv -> TCvSubst
- setCvSubstEnv :: TCvSubst -> CvSubstEnv -> TCvSubst
- zapTCvSubst :: TCvSubst -> TCvSubst
- extendTCvInScope :: TCvSubst -> Var -> TCvSubst
- extendTCvInScopeList :: TCvSubst -> [Var] -> TCvSubst
- extendTCvInScopeSet :: TCvSubst -> VarSet -> TCvSubst
- extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst
- extendTCvSubstWithClone :: TCvSubst -> TyCoVar -> TyCoVar -> TCvSubst
- extendCvSubst :: TCvSubst -> CoVar -> Coercion -> TCvSubst
- extendCvSubstWithClone :: TCvSubst -> CoVar -> CoVar -> TCvSubst
- extendTvSubst :: TCvSubst -> TyVar -> Type -> TCvSubst
- extendTvSubstBinderAndInScope :: TCvSubst -> TyCoBinder -> Type -> TCvSubst
- extendTvSubstWithClone :: TCvSubst -> TyVar -> TyVar -> TCvSubst
- extendTvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst
- extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst
- extendTCvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst
- unionTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst
- zipTyEnv :: HasDebugCallStack => [TyVar] -> [Type] -> TvSubstEnv
- zipCoEnv :: HasDebugCallStack => [CoVar] -> [Coercion] -> CvSubstEnv
- mkTyCoInScopeSet :: [Type] -> [Coercion] -> InScopeSet
- zipTvSubst :: HasDebugCallStack => [TyVar] -> [Type] -> TCvSubst
- zipCvSubst :: HasDebugCallStack => [CoVar] -> [Coercion] -> TCvSubst
- zipTCvSubst :: HasDebugCallStack => [TyCoVar] -> [Type] -> TCvSubst
- mkTvSubstPrs :: [(TyVar, Type)] -> TCvSubst
- substTyWith :: HasCallStack => [TyVar] -> [Type] -> Type -> Type
- substTyWithCoVars :: [CoVar] -> [Coercion] -> Type -> Type
- substTysWith :: [TyVar] -> [Type] -> [Type] -> [Type]
- substTysWithCoVars :: [CoVar] -> [Coercion] -> [Type] -> [Type]
- substCoWith :: HasCallStack => [TyVar] -> [Type] -> Coercion -> Coercion
- substTy :: HasCallStack => TCvSubst -> Type -> Type
- substTyAddInScope :: TCvSubst -> Type -> Type
- substTyUnchecked :: TCvSubst -> Type -> Type
- substTysUnchecked :: TCvSubst -> [Type] -> [Type]
- substThetaUnchecked :: TCvSubst -> ThetaType -> ThetaType
- substTyWithUnchecked :: [TyVar] -> [Type] -> Type -> Type
- substCoUnchecked :: TCvSubst -> Coercion -> Coercion
- substCoWithUnchecked :: [TyVar] -> [Type] -> Coercion -> Coercion
- substTyWithInScope :: InScopeSet -> [TyVar] -> [Type] -> Type -> Type
- substTys :: HasCallStack => TCvSubst -> [Type] -> [Type]
- substTheta :: HasCallStack => TCvSubst -> ThetaType -> ThetaType
- lookupTyVar :: TCvSubst -> TyVar -> Maybe Type
- substCo :: HasCallStack => TCvSubst -> Coercion -> Coercion
- substCos :: HasCallStack => TCvSubst -> [Coercion] -> [Coercion]
- substCoVar :: TCvSubst -> CoVar -> Coercion
- substCoVars :: TCvSubst -> [CoVar] -> [Coercion]
- lookupCoVar :: TCvSubst -> Var -> Maybe Coercion
- cloneTyVarBndr :: TCvSubst -> TyVar -> Unique -> (TCvSubst, TyVar)
- cloneTyVarBndrs :: TCvSubst -> [TyVar] -> UniqSupply -> (TCvSubst, [TyVar])
- substVarBndr :: HasCallStack => TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar)
- substVarBndrs :: HasCallStack => TCvSubst -> [TyCoVar] -> (TCvSubst, [TyCoVar])
- substTyVarBndr :: HasCallStack => TCvSubst -> TyVar -> (TCvSubst, TyVar)
- substTyVarBndrs :: HasCallStack => TCvSubst -> [TyVar] -> (TCvSubst, [TyVar])
- substCoVarBndr :: HasCallStack => TCvSubst -> CoVar -> (TCvSubst, CoVar)
- substTyVar :: TCvSubst -> TyVar -> Type
- substTyVars :: TCvSubst -> [TyVar] -> [Type]
- substTyCoVars :: TCvSubst -> [TyCoVar] -> [Type]
- substForAllCoBndr :: TCvSubst -> TyCoVar -> KindCoercion -> (TCvSubst, TyCoVar, Coercion)
- substVarBndrUsing :: (TCvSubst -> Type -> Type) -> TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar)
- substForAllCoBndrUsing :: Bool -> (Coercion -> Coercion) -> TCvSubst -> TyCoVar -> KindCoercion -> (TCvSubst, TyCoVar, KindCoercion)
- checkValidSubst :: HasCallStack => TCvSubst -> [Type] -> [Coercion] -> a -> a
- isValidTCvSubst :: TCvSubst -> Bool
- tidyType :: TidyEnv -> Type -> Type
- tidyTypes :: TidyEnv -> [Type] -> [Type]
- tidyOpenType :: TidyEnv -> Type -> (TidyEnv, Type)
- tidyOpenTypes :: TidyEnv -> [Type] -> (TidyEnv, [Type])
- tidyOpenKind :: TidyEnv -> Kind -> (TidyEnv, Kind)
- tidyVarBndr :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
- tidyVarBndrs :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
- tidyFreeTyCoVars :: TidyEnv -> [TyCoVar] -> TidyEnv
- avoidNameClashes :: [TyCoVar] -> TidyEnv -> TidyEnv
- tidyOpenTyCoVar :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
- tidyOpenTyCoVars :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
- tidyTyCoVarOcc :: TidyEnv -> TyCoVar -> TyCoVar
- tidyTopType :: Type -> Type
- tidyKind :: TidyEnv -> Kind -> Kind
- tidyCo :: TidyEnv -> Coercion -> Coercion
- tidyCos :: TidyEnv -> [Coercion] -> [Coercion]
- tidyTyCoVarBinder :: TidyEnv -> VarBndr TyCoVar vis -> (TidyEnv, VarBndr TyCoVar vis)
- tidyTyCoVarBinders :: TidyEnv -> [VarBndr TyCoVar vis] -> (TidyEnv, [VarBndr TyCoVar vis])
- typeSize :: Type -> Int
- coercionSize :: Coercion -> Int
- provSize :: UnivCoProvenance -> Int
Documentation
tyThingCategory :: TyThing -> String Source #
pprTyThingCategory :: TyThing -> SDoc Source #
pprShortTyThing :: TyThing -> SDoc Source #
Types
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 Type Type | t1 -> t2 Very common, so an important special case |
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 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 :: forall r r'. (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 # | |
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 Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TyLit Source # toConstr :: TyLit -> Constr Source # dataTypeOf :: TyLit -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TyLit) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TyLit) Source # gmapT :: (forall b. Data b => b -> b) -> TyLit -> TyLit Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TyLit -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TyLit -> r Source # gmapQ :: (forall d. Data d => d -> u) -> TyLit -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> TyLit -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TyLit -> m TyLit Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TyLit -> m TyLit Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TyLit -> m TyLit Source # | |
Ord TyLit # | |
Outputable TyLit # | |
type KindOrType = Type Source #
The key representation of types within the compiler
type KnotTied ty = ty Source #
A type labeled KnotTied
might have knot-tied tycons in it. See
Note [Type checking recursive type and class declarations] in
TcTyClsDecls
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"
Argument Flag
Is something required to appear in source Haskell (Required
),
permitted by request (Specified
) (visible type application), or
prohibited entirely from appearing in source Haskell (Inferred
)?
See Note [VarBndrs, TyCoVarBinders, TyConBinders, and visibility] in TyCoRep
Instances
Eq ArgFlag # | |
Data ArgFlag # | |
Defined in Var gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ArgFlag -> c ArgFlag Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ArgFlag Source # toConstr :: ArgFlag -> Constr Source # dataTypeOf :: ArgFlag -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ArgFlag) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArgFlag) Source # gmapT :: (forall b. Data b => b -> b) -> ArgFlag -> ArgFlag Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ArgFlag -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ArgFlag -> r Source # gmapQ :: (forall d. Data d => d -> u) -> ArgFlag -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> ArgFlag -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ArgFlag -> m ArgFlag Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ArgFlag -> m ArgFlag Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ArgFlag -> m ArgFlag Source # | |
Ord ArgFlag # | |
Outputable ArgFlag # | |
Binary ArgFlag # | |
Outputable tv => Outputable (VarBndr tv ArgFlag) # | |
Coercions
A Coercion
is concrete evidence of the equality/convertibility
of two types.
Refl Type | |
GRefl Role Type MCoercionN | |
TyConAppCo Role TyCon [Coercion] | |
AppCo Coercion CoercionN | |
ForAllCo TyCoVar KindCoercion Coercion | |
FunCo Role Coercion Coercion | |
CoVarCo CoVar | |
AxiomInstCo (CoAxiom Branched) BranchIndex [Coercion] | |
AxiomRuleCo CoAxiomRule [Coercion] | |
UnivCo UnivCoProvenance Role Type Type | |
SymCo Coercion | |
TransCo Coercion Coercion | |
NthCo Role Int Coercion | |
LRCo LeftOrRight CoercionN | |
InstCo Coercion CoercionN | |
KindCo Coercion | |
SubCo CoercionN | |
HoleCo CoercionHole | See Note [Coercion holes] Only present during typechecking |
Instances
Data Coercion # | |
Defined in TyCoRep gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Coercion -> c Coercion Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Coercion Source # toConstr :: Coercion -> Constr Source # dataTypeOf :: Coercion -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Coercion) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Coercion) Source # gmapT :: (forall b. Data b => b -> b) -> Coercion -> Coercion Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Coercion -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Coercion -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Coercion -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Coercion -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Coercion -> m Coercion Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Coercion -> m Coercion Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Coercion -> m Coercion Source # | |
Outputable Coercion # | |
data UnivCoProvenance Source #
For simplicity, we have just one UnivCo that represents a coercion from
some type to some other type, with (in general) no restrictions on the
type. The UnivCoProvenance specifies more exactly what the coercion really
is and why a program should (or shouldn't!) trust the coercion.
It is reasonable to consider each constructor of UnivCoProvenance
as a totally independent coercion form; their only commonality is
that they don't tell you what types they coercion between. (That info
is in the UnivCo
constructor of Coercion
.
UnsafeCoerceProv | From |
PhantomProv KindCoercion | See Note [Phantom coercions]. Only in Phantom roled coercions |
ProofIrrelProv KindCoercion | From the fact that any two coercions are considered equivalent. See Note [ProofIrrelProv]. Can be used in Nominal or Representational coercions |
PluginProv String | From a plugin, which asserts that this coercion is sound. The string is for the use of the plugin. |
Instances
Data UnivCoProvenance # | |
Defined in TyCoRep gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UnivCoProvenance -> c UnivCoProvenance Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UnivCoProvenance Source # toConstr :: UnivCoProvenance -> Constr Source # dataTypeOf :: UnivCoProvenance -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UnivCoProvenance) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UnivCoProvenance) Source # gmapT :: (forall b. Data b => b -> b) -> UnivCoProvenance -> UnivCoProvenance Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UnivCoProvenance -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UnivCoProvenance -> r Source # gmapQ :: (forall d. Data d => d -> u) -> UnivCoProvenance -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> UnivCoProvenance -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UnivCoProvenance -> m UnivCoProvenance Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UnivCoProvenance -> m UnivCoProvenance Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UnivCoProvenance -> m UnivCoProvenance Source # | |
Outputable UnivCoProvenance # | |
data CoercionHole Source #
A coercion to be filled in by the type-checker. See Note [Coercion holes]
Instances
Data CoercionHole # | |
Defined in TyCoRep gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CoercionHole -> c CoercionHole Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CoercionHole Source # toConstr :: CoercionHole -> Constr Source # dataTypeOf :: CoercionHole -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CoercionHole) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CoercionHole) Source # gmapT :: (forall b. Data b => b -> b) -> CoercionHole -> CoercionHole Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CoercionHole -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CoercionHole -> r Source # gmapQ :: (forall d. Data d => d -> u) -> CoercionHole -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> CoercionHole -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CoercionHole -> m CoercionHole Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CoercionHole -> m CoercionHole Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CoercionHole -> m CoercionHole Source # | |
Outputable CoercionHole # | |
coHoleCoVar :: CoercionHole -> CoVar Source #
setCoHoleCoVar :: CoercionHole -> CoVar -> CoercionHole Source #
type KindCoercion = CoercionN Source #
A semantically more meaningful type to represent what may or may not be a
useful Coercion
.
Instances
Data MCoercion # | |
Defined in TyCoRep gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> MCoercion -> c MCoercion Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c MCoercion Source # toConstr :: MCoercion -> Constr Source # dataTypeOf :: MCoercion -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c MCoercion) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MCoercion) Source # gmapT :: (forall b. Data b => b -> b) -> MCoercion -> MCoercion Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MCoercion -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MCoercion -> r Source # gmapQ :: (forall d. Data d => d -> u) -> MCoercion -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> MCoercion -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> MCoercion -> m MCoercion Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MCoercion -> m MCoercion Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MCoercion -> m MCoercion Source # | |
Outputable MCoercion # | |
type MCoercionR = MCoercion Source #
type MCoercionN = MCoercion Source #
Functions over types
mkTyConTy :: TyCon -> Type Source #
Create the plain type constructor type which has been applied to no type arguments at all.
mkTyVarTys :: [TyVar] -> [Type] Source #
mkTyCoVarTy :: TyCoVar -> Type Source #
mkTyCoVarTys :: [TyCoVar] -> [Type] Source #
mkTyCoForAllTy :: TyCoVar -> ArgFlag -> Type -> Type Source #
If tv is a coercion variable and it is not used in the body, returns a FunTy, otherwise makes a forall type. See Note [Unused coercion variable in ForAllTy]
mkForAllTys :: [TyCoVarBinder] -> Type -> Type Source #
Wraps foralls over the type using the provided TyCoVar
s from left to right
mkForAllTy :: TyCoVar -> ArgFlag -> Type -> Type Source #
Like mkTyCoForAllTy
, but does not check the occurrence of the binder
See Note [Unused coercion variable in ForAllTy]
mkTyCoPiTy :: TyCoBinder -> Type -> Type Source #
mkTyCoPiTys :: [TyCoBinder] -> Type -> Type Source #
mkPiTys :: [TyCoBinder] -> Type -> Type Source #
Like mkTyCoPiTys
, but does not check the occurrence of the binder
kindRep_maybe :: HasDebugCallStack => Kind -> Maybe Type Source #
Given a kind (TYPE rr), extract its RuntimeRep classifier rr.
For example, kindRep_maybe * = Just LiftedRep
Returns Nothing
if the kind is not of form (TYPE rr)
Treats * and Constraint as the same
kindRep :: HasDebugCallStack => Kind -> Type Source #
Extract the RuntimeRep classifier of a type from its kind. For example,
kindRep * = LiftedRep
; Panics if this is not possible.
Treats * and Constraint as the same
isLiftedTypeKind :: Kind -> Bool Source #
This version considers Constraint to be the same as *. Returns True if the argument is equivalent to Type/Constraint and False otherwise. See Note [Kind Constraint and kind Type]
isUnliftedTypeKind :: Kind -> Bool Source #
Returns True if the kind classifies unlifted types and False otherwise. Note that this returns False for levity-polymorphic kinds, which may be specialized to a kind that classifies unlifted types.
isLiftedRuntimeRep :: Type -> Bool Source #
isUnliftedRuntimeRep :: Type -> Bool Source #
isRuntimeRepTy :: Type -> Bool Source #
Is this the type RuntimeRep
?
isRuntimeRepVar :: TyVar -> Bool Source #
Is a tyvar of type RuntimeRep
?
Functions over binders
data TyCoBinder Source #
A TyCoBinder
represents an argument to a function. TyCoBinders can be
dependent (Named
) or nondependent (Anon
). They may also be visible or
not. See Note [TyCoBinders]
Instances
Data TyCoBinder # | |
Defined in TyCoRep gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TyCoBinder -> c TyCoBinder Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TyCoBinder Source # toConstr :: TyCoBinder -> Constr Source # dataTypeOf :: TyCoBinder -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TyCoBinder) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TyCoBinder) Source # gmapT :: (forall b. Data b => b -> b) -> TyCoBinder -> TyCoBinder Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TyCoBinder -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TyCoBinder -> r Source # gmapQ :: (forall d. Data d => d -> u) -> TyCoBinder -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> TyCoBinder -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TyCoBinder -> m TyCoBinder Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TyCoBinder -> m TyCoBinder Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TyCoBinder -> m TyCoBinder Source # | |
Outputable TyCoBinder # | |
type TyCoVarBinder = VarBndr TyCoVar ArgFlag Source #
Variable Binder
A TyCoVarBinder
is the binder of a ForAllTy
It's convenient to define this synonym here rather its natural
home in TyCoRep, because it's used in DataCon.hs-boot
A TyVarBinder
is a binder with only TyVar
type TyBinder = TyCoBinder Source #
TyBinder
is like TyCoBinder
, but there can only be TyVarBinder
in the Named
field.
binderVars :: [VarBndr tv argf] -> [tv] Source #
binderArgFlag :: VarBndr tv argf -> argf Source #
delBinderVar :: VarSet -> TyCoVarBinder -> VarSet Source #
Remove the binder's variable from the set, if the binder has a variable.
isInvisibleArgFlag :: ArgFlag -> Bool Source #
Does this ArgFlag
classify an argument that is not written in Haskell?
isVisibleArgFlag :: ArgFlag -> Bool Source #
Does this ArgFlag
classify an argument that is written in Haskell?
isInvisibleBinder :: TyCoBinder -> Bool Source #
Does this binder bind an invisible argument?
isVisibleBinder :: TyCoBinder -> Bool Source #
Does this binder bind a visible argument?
isTyBinder :: TyCoBinder -> Bool Source #
If its a named binder, is the binder a tyvar? Returns True for nondependent binder.
isNamedBinder :: TyCoBinder -> Bool Source #
Functions over coercions
pickLR :: LeftOrRight -> (a, a) -> a Source #
Pretty-printing
pprParendType :: Type -> SDoc Source #
pprTCvBndr :: TyCoVarBinder -> SDoc Source #
pprTCvBndrs :: [TyCoVarBinder] -> SDoc Source #
pprSigmaType :: Type -> SDoc Source #
pprParendTheta :: ThetaType -> SDoc Source #
pprForAll :: [TyCoVarBinder] -> SDoc Source #
pprUserForAll :: [TyCoVarBinder] -> SDoc Source #
Print a user-level forall; see Note [When to print foralls]
pprThetaArrowTy :: ThetaType -> SDoc Source #
pprParendKind :: Kind -> SDoc Source #
A general-purpose pretty-printing precedence type.
pprDataCons :: TyCon -> SDoc Source #
pprParendCo :: Coercion -> SDoc Source #
debugPprType :: Type -> SDoc Source #
debugPprType is a simple pretty printer that prints a type without going through IfaceType. It does not format as prettily as the normal route, but it's much more direct, and that can be useful for debugging. E.g. with -dppr-debug it prints the kind on type-variable occurrences which the normal route fundamentally cannot do.
Free variables
tyCoVarsOfType :: Type -> TyCoVarSet Source #
tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet Source #
tyCoFVsOfType
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.
tyCoVarsOfTypes :: [Type] -> TyCoVarSet Source #
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.
tyCoFVsBndr :: TyCoVarBinder -> FV -> FV Source #
tyCoFVsOfType :: Type -> FV Source #
The worker for tyCoFVsOfType
and tyCoFVsOfTypeList
.
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) See Note [FV eta expansion] in FV for explanation.
tyCoVarsOfTypeList :: Type -> [TyCoVar] Source #
tyCoFVsOfType
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.
tyCoFVsOfTypes :: [Type] -> FV Source #
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.
coVarsOfType :: Type -> CoVarSet Source #
coVarsOfTypes :: [Type] -> TyCoVarSet Source #
coVarsOfCo :: Coercion -> CoVarSet Source #
coVarsOfCos :: [Coercion] -> CoVarSet Source #
tyCoVarsOfCo :: Coercion -> TyCoVarSet Source #
tyCoVarsOfCos :: [Coercion] -> TyCoVarSet Source #
tyCoVarsOfCoDSet :: Coercion -> DTyCoVarSet Source #
Get a deterministic set of the vars free in a coercion
tyCoFVsOfCo :: Coercion -> FV Source #
tyCoFVsOfCos :: [Coercion] -> FV Source #
tyCoVarsOfCoList :: Coercion -> [TyCoVar] Source #
almostDevoidCoVarOfCo :: CoVar -> Coercion -> Bool Source #
Given a covar and a coercion, returns True if covar is almost devoid in the coercion. That is, covar can only appear in Refl and GRefl. See last wrinkle in Note [Unused coercion variable in ForAllCo] in Coercion
injectiveVarsOfBinder :: TyConBinder -> FV Source #
Returns the free variables of a TyConBinder
that are in injective
positions. (See Note [Kind annotations on TyConApps]
in TcSplice for an
explanation of what an injective position is.)
injectiveVarsOfType :: Type -> FV Source #
noFreeVarsOfType :: Type -> Bool Source #
Returns True if this type has no free variables. Should be the same as isEmptyVarSet . tyCoVarsOfType, but faster in the non-forall case.
noFreeVarsOfCo :: Coercion -> Bool Source #
Returns True if this coercion has no free variables. Should be the same as isEmptyVarSet . tyCoVarsOfCo, but faster in the non-forall case.
Substitutions
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.
composeTCvSubstEnv :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> (TvSubstEnv, CvSubstEnv) -> (TvSubstEnv, CvSubstEnv) Source #
(compose env1 env2)(x)
is env1(env2(x))
; i.e. apply env2
then env1
.
It assumes that both are idempotent.
Typically, env1
is the refinement to a base substitution env2
composeTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst Source #
Composes two substitutions, applying the second one provided first, like in function composition.
mkEmptyTCvSubst :: InScopeSet -> TCvSubst Source #
isEmptyTCvSubst :: TCvSubst -> Bool Source #
mkTCvSubst :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> TCvSubst Source #
mkTvSubst :: InScopeSet -> TvSubstEnv -> TCvSubst Source #
Make a TCvSubst with specified tyvar subst and empty covar subst
mkCvSubst :: InScopeSet -> CvSubstEnv -> TCvSubst Source #
Make a TCvSubst with specified covar subst and empty tyvar subst
getTvSubstEnv :: TCvSubst -> TvSubstEnv Source #
getCvSubstEnv :: TCvSubst -> CvSubstEnv Source #
getTCvInScope :: TCvSubst -> InScopeSet Source #
getTCvSubstRangeFVs :: TCvSubst -> VarSet Source #
Returns the free variables of the types in the range of a substitution as a non-deterministic set.
setTvSubstEnv :: TCvSubst -> TvSubstEnv -> TCvSubst Source #
setCvSubstEnv :: TCvSubst -> CvSubstEnv -> TCvSubst Source #
zapTCvSubst :: TCvSubst -> TCvSubst Source #
extendTvSubstBinderAndInScope :: TCvSubst -> TyCoBinder -> Type -> TCvSubst Source #
zipTyEnv :: HasDebugCallStack => [TyVar] -> [Type] -> TvSubstEnv Source #
zipCoEnv :: HasDebugCallStack => [CoVar] -> [Coercion] -> CvSubstEnv Source #
mkTyCoInScopeSet :: [Type] -> [Coercion] -> InScopeSet Source #
Generates an in-scope set from the free variables in a list of types and a list of coercions
zipTvSubst :: HasDebugCallStack => [TyVar] -> [Type] -> TCvSubst Source #
Generates the in-scope set for the TCvSubst
from the types in the incoming
environment. No CoVars, please!
zipCvSubst :: HasDebugCallStack => [CoVar] -> [Coercion] -> TCvSubst Source #
Generates the in-scope set for the TCvSubst
from the types in the incoming
environment. No TyVars, please!
zipTCvSubst :: HasDebugCallStack => [TyCoVar] -> [Type] -> TCvSubst Source #
mkTvSubstPrs :: [(TyVar, Type)] -> TCvSubst Source #
Generates the in-scope set for the TCvSubst
from the types in the
incoming environment. No CoVars, please!
substTyWith :: HasCallStack => [TyVar] -> [Type] -> Type -> Type Source #
Type substitution, see zipTvSubst
substTysWith :: [TyVar] -> [Type] -> [Type] -> [Type] Source #
Type substitution, see zipTvSubst
substTysWithCoVars :: [CoVar] -> [Coercion] -> [Type] -> [Type] Source #
Type substitution, see zipTvSubst
substCoWith :: HasCallStack => [TyVar] -> [Type] -> Coercion -> Coercion Source #
Coercion substitution, see zipTvSubst
substTy :: HasCallStack => TCvSubst -> Type -> Type Source #
Substitute within a Type
The substitution has to satisfy the invariants described in
Note [The substitution invariant].
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.
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.
substTyWithInScope :: InScopeSet -> [TyVar] -> [Type] -> Type -> Type Source #
Substitute tyvars within a type using a known InScopeSet
.
Pre-condition: the in_scope
set should satisfy Note [The substitution
invariant]; specifically it should include the free vars of tys
,
and of ty
minus the domain of the subst.
substTys :: HasCallStack => TCvSubst -> [Type] -> [Type] Source #
Substitute within several Type
s
The substitution has to satisfy the invariants described in
Note [The substitution invariant].
substTheta :: HasCallStack => TCvSubst -> ThetaType -> ThetaType Source #
Substitute within a ThetaType
The substitution has to satisfy the invariants described in
Note [The substitution invariant].
substCo :: HasCallStack => TCvSubst -> Coercion -> Coercion Source #
Substitute within a Coercion
The substitution has to satisfy the invariants described in
Note [The substitution invariant].
substCos :: HasCallStack => TCvSubst -> [Coercion] -> [Coercion] Source #
Substitute within several Coercion
s
The substitution has to satisfy the invariants described in
Note [The substitution invariant].
cloneTyVarBndrs :: TCvSubst -> [TyVar] -> UniqSupply -> (TCvSubst, [TyVar]) Source #
substVarBndr :: HasCallStack => TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar) Source #
substVarBndrs :: HasCallStack => TCvSubst -> [TyCoVar] -> (TCvSubst, [TyCoVar]) Source #
substTyVarBndr :: HasCallStack => TCvSubst -> TyVar -> (TCvSubst, TyVar) Source #
substTyVarBndrs :: HasCallStack => TCvSubst -> [TyVar] -> (TCvSubst, [TyVar]) Source #
substCoVarBndr :: HasCallStack => TCvSubst -> CoVar -> (TCvSubst, CoVar) Source #
substForAllCoBndr :: TCvSubst -> TyCoVar -> KindCoercion -> (TCvSubst, TyCoVar, Coercion) Source #
substVarBndrUsing :: (TCvSubst -> Type -> Type) -> TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar) Source #
substForAllCoBndrUsing :: Bool -> (Coercion -> Coercion) -> TCvSubst -> TyCoVar -> KindCoercion -> (TCvSubst, TyCoVar, KindCoercion) Source #
checkValidSubst :: HasCallStack => TCvSubst -> [Type] -> [Coercion] -> a -> a Source #
This checks if the substitution satisfies the invariant from Note [The substitution invariant].
isValidTCvSubst :: TCvSubst -> Bool Source #
When calling substTy
it should be the case that the in-scope set in
the substitution is a superset of the free vars of the range of the
substitution.
See also Note [The substitution invariant].
Tidying type related things up for printing
tidyOpenTypes :: TidyEnv -> [Type] -> (TidyEnv, [Type]) Source #
Grabs the free type variables, tidies them
and then uses tidyType
to work over the type itself
tidyVarBndrs :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar]) Source #
This tidies up a type for printing in an error message, or in an interface file.
It doesn't change the uniques at all, just the print names.
tidyFreeTyCoVars :: TidyEnv -> [TyCoVar] -> TidyEnv Source #
Add the free TyVar
s to the env in tidy form,
so that we can tidy the type they are free in
tidyOpenTyCoVar :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar) Source #
Treat a new TyCoVar
as a binder, and give it a fresh tidy name
using the environment if one has not already been allocated. See
also tidyVarBndr
tidyTopType :: Type -> Type Source #
Calls tidyType
on a top-level type (i.e. with an empty tidying environment)
Sizes
coercionSize :: Coercion -> Int Source #
provSize :: UnivCoProvenance -> Int Source #