ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Tc.Utils.TcMType

Description

Monadic type operations

This module contains monadic operations over types that contain mutable type variables.

Synopsis

- type TcTyVar = Var
- type TcKind = Kind
- type TcType = Type
- type TcTauType = TcType
- type TcThetaType = ThetaType
- type TcTyVarSet = TyVarSet
- newFlexiTyVar :: Kind -> TcM TcTyVar
- newNamedFlexiTyVar :: FastString -> Kind -> TcM TcTyVar
- newFlexiTyVarTy :: Kind -> TcM TcType
- newFlexiTyVarTys :: Int -> Kind -> TcM [TcType]
- newOpenFlexiTyVar :: TcM TcTyVar
- newOpenFlexiTyVarTy :: TcM TcType
- newOpenTypeKind :: TcM TcKind
- newOpenBoxedTypeKind :: TcM TcKind
- newMetaKindVar :: TcM TcKind
- newMetaKindVars :: Int -> TcM [TcKind]
- newMetaTyVarTyAtLevel :: TcLevel -> TcKind -> TcM TcType
- newAnonMetaTyVar :: MetaInfo -> Kind -> TcM TcTyVar
- newConcreteTyVar :: HasDebugCallStack => ConcreteTvOrigin -> TcKind -> TcM TcTyVar
- cloneMetaTyVar :: TcTyVar -> TcM TcTyVar
- newCycleBreakerTyVar :: TcKind -> TcM TcTyVar
- newMultiplicityVar :: TcM TcType
- readMetaTyVar :: TyVar -> TcM MetaDetails
- writeMetaTyVar :: HasDebugCallStack => TcTyVar -> TcType -> TcM ()
- writeMetaTyVarRef :: HasDebugCallStack => TcTyVar -> TcRef MetaDetails -> TcType -> TcM ()
- newTauTvDetailsAtLevel :: TcLevel -> TcM TcTyVarDetails
- newMetaDetails :: MetaInfo -> TcM TcTyVarDetails
- newMetaTyVarName :: FastString -> TcM Name
- isFilledMetaTyVar_maybe :: TcTyVar -> TcM (Maybe Type)
- isFilledMetaTyVar :: TyVar -> TcM Bool
- isUnfilledMetaTyVar :: TyVar -> TcM Bool
- newEvVar :: TcPredType -> TcRnIf gbl lcl EvVar
- newEvVars :: TcThetaType -> TcM [EvVar]
- newDict :: Class -> [TcType] -> TcM DictId
- newWantedWithLoc :: CtLoc -> PredType -> TcM CtEvidence
- newWanted :: CtOrigin -> Maybe TypeOrKind -> PredType -> TcM CtEvidence
- newWanteds :: CtOrigin -> ThetaType -> TcM [CtEvidence]
- cloneWanted :: Ct -> TcM Ct
- cloneWC :: WantedConstraints -> TcM WantedConstraints
- cloneWantedCtEv :: CtEvidence -> TcM CtEvidence
- emitWanted :: CtOrigin -> TcPredType -> TcM EvTerm
- emitWantedEq :: CtOrigin -> TypeOrKind -> Role -> TcType -> TcType -> TcM Coercion
- emitWantedEvVar :: CtOrigin -> TcPredType -> TcM EvVar
- emitWantedEvVars :: CtOrigin -> [TcPredType] -> TcM [EvVar]
- emitWantedEqs :: CtOrigin -> [(TcType, TcType)] -> TcM ()
- newTcEvBinds :: TcM EvBindsVar
- newNoTcEvBinds :: TcM EvBindsVar
- addTcEvBind :: EvBindsVar -> EvBind -> TcM ()
- emitNewExprHole :: RdrName -> Type -> TcM HoleExprRef
- newCoercionHole :: TcPredType -> TcM CoercionHole
- fillCoercionHole :: CoercionHole -> Coercion -> TcM ()
- isFilledCoercionHole :: CoercionHole -> TcM Bool
- unpackCoercionHole :: CoercionHole -> TcM Coercion
- unpackCoercionHole_maybe :: CoercionHole -> TcM (Maybe Coercion)
- checkCoercionHole :: CoVar -> Coercion -> TcM Coercion
- type ConcreteHole = CoercionHole
- newConcreteHole :: Kind -> Type -> TcM (ConcreteHole, TcType)
- newImplication :: TcM Implication
- newMetaTyVars :: [TyVar] -> TcM (Subst, [TcTyVar])
- newMetaTyVarX :: Subst -> TyVar -> TcM (Subst, TcTyVar)
- newMetaTyVarsX :: Subst -> [TyVar] -> TcM (Subst, [TcTyVar])
- newMetaTyVarTyVarX :: Subst -> TyVar -> TcM (Subst, TcTyVar)
- newTyVarTyVar :: Name -> Kind -> TcM TcTyVar
- cloneTyVarTyVar :: Name -> Kind -> TcM TcTyVar
- newPatSigTyVar :: Name -> Kind -> TcM TcTyVar
- newSkolemTyVar :: SkolemInfo -> Name -> Kind -> TcM TcTyVar
- newWildCardX :: Subst -> TyVar -> TcM (Subst, TcTyVar)
- data ExpType
  - = Check TcType
  - | Infer !InferResult
- type ExpSigmaType = ExpType
- type ExpRhoType = ExpType
- mkCheckExpType :: TcType -> ExpType
- newInferExpType :: TcM ExpType
- newInferExpTypeFRR :: FixedRuntimeRepContext -> TcM ExpTypeFRR
- tcInfer :: (ExpSigmaType -> TcM a) -> TcM (a, TcSigmaType)
- tcInferFRR :: FixedRuntimeRepContext -> (ExpSigmaTypeFRR -> TcM a) -> TcM (a, TcSigmaTypeFRR)
- readExpType :: ExpType -> TcM TcType
- readExpType_maybe :: ExpType -> TcM (Maybe TcType)
- readScaledExpType :: Scaled ExpType -> TcM (Scaled Type)
- expTypeToType :: ExpType -> TcM TcType
- scaledExpTypeToType :: Scaled ExpType -> TcM (Scaled TcType)
- checkingExpType_maybe :: ExpType -> Maybe TcType
- checkingExpType :: String -> ExpType -> TcType
- inferResultToType :: InferResult -> TcM Type
- ensureMonoType :: TcType -> TcM ()
- promoteTcType :: TcLevel -> TcType -> TcM (TcCoercionN, TcType)
- zonkTidyTcType :: TidyEnv -> TcType -> TcM (TidyEnv, TcType)
- zonkTidyTcTypes :: TidyEnv -> [TcType] -> TcM (TidyEnv, [TcType])
- zonkTidyOrigin :: TidyEnv -> CtOrigin -> TcM (TidyEnv, CtOrigin)
- zonkTidyOrigins :: TidyEnv -> [CtOrigin] -> TcM (TidyEnv, [CtOrigin])
- zonkTidyFRRInfos :: TidyEnv -> [FixedRuntimeRepErrorInfo] -> TcM (TidyEnv, [FixedRuntimeRepErrorInfo])
- tidyEvVar :: TidyEnv -> EvVar -> EvVar
- tidyCt :: TidyEnv -> Ct -> Ct
- tidyHole :: TidyEnv -> Hole -> Hole
- tidyDelayedError :: TidyEnv -> DelayedError -> DelayedError
- zonkTcTyVar :: TcTyVar -> TcM TcType
- zonkTcTyVars :: [TcTyVar] -> TcM [TcType]
- zonkTcTyVarToTcTyVar :: HasDebugCallStack => TcTyVar -> TcM TcTyVar
- zonkTcTyVarsToTcTyVars :: HasDebugCallStack => [TcTyVar] -> TcM [TcTyVar]
- zonkInvisTVBinder :: VarBndr TcTyVar spec -> TcM (VarBndr TcTyVar spec)
- zonkTyCoVarsAndFV :: TyCoVarSet -> TcM TyCoVarSet
- zonkTcTypeAndFV :: TcType -> TcM DTyCoVarSet
- zonkDTyCoVarSetAndFV :: DTyCoVarSet -> TcM DTyCoVarSet
- zonkTyCoVarsAndFVList :: [TyCoVar] -> TcM [TyCoVar]
- zonkTcType :: TcType -> TcM TcType
- zonkTcTypes :: [TcType] -> TcM [TcType]
- zonkCo :: Coercion -> TcM Coercion
- zonkTyCoVarKind :: TyCoVar -> TcM TyCoVar
- zonkEvVar :: EvVar -> TcM EvVar
- zonkWC :: WantedConstraints -> TcM WantedConstraints
- zonkImplication :: Implication -> TcM Implication
- zonkSimples :: Cts -> TcM Cts
- zonkId :: TcId -> TcM TcId
- zonkCoVar :: CoVar -> TcM CoVar
- zonkCt :: Ct -> TcM Ct
- zonkSkolemInfo :: SkolemInfo -> TcM SkolemInfo
- zonkSkolemInfoAnon :: SkolemInfoAnon -> TcM SkolemInfoAnon
- defaultTyVar :: DefaultingStrategy -> TcTyVar -> TcM Bool
- promoteMetaTyVarTo :: HasDebugCallStack => TcLevel -> TcTyVar -> TcM Bool
- promoteTyVarSet :: HasDebugCallStack => TcTyVarSet -> TcM Bool
- quantifyTyVars :: SkolemInfo -> NonStandardDefaultingStrategy -> CandidatesQTvs -> TcM [TcTyVar]
- isQuantifiableTv :: TcLevel -> TcTyVar -> Bool
- zonkAndSkolemise :: SkolemInfo -> TcTyCoVar -> TcM TcTyCoVar
- skolemiseQuantifiedTyVar :: SkolemInfo -> TcTyVar -> TcM TcTyVar
- doNotQuantifyTyVars :: CandidatesQTvs -> (TidyEnv -> TcM (TidyEnv, SDoc)) -> TcM ()
- candidateQTyVarsOfType :: TcType -> TcM CandidatesQTvs
- candidateQTyVarsOfKind :: TcKind -> TcM CandidatesQTvs
- candidateQTyVarsOfTypes :: [Type] -> TcM CandidatesQTvs
- candidateQTyVarsOfKinds :: [TcKind] -> TcM CandidatesQTvs
- candidateQTyVarsWithBinders :: [TyVar] -> Type -> TcM CandidatesQTvs
- data CandidatesQTvs = DV {
  - dv_kvs :: DTyVarSet
  - dv_tvs :: DTyVarSet
  - dv_cvs :: CoVarSet
  }
- delCandidates :: CandidatesQTvs -> [Var] -> CandidatesQTvs
- candidateKindVars :: CandidatesQTvs -> TyVarSet
- partitionCandidates :: CandidatesQTvs -> (TyVar -> Bool) -> (TyVarSet, CandidatesQTvs)
- checkTypeHasFixedRuntimeRep :: FixedRuntimeRepProvenance -> Type -> TcM ()
- anyUnfilledCoercionHoles :: RewriterSet -> TcM Bool

# Documentation

type TcTyVar = Var Source #

Type variable that might be a metavariable

type TcKind = Kind Source #

type TcType = Type Source #

type TcTauType = TcType Source #

type TcThetaType = ThetaType Source #

type TcTyVarSet = TyVarSet Source #

newFlexiTyVar :: Kind -> TcM TcTyVar Source #

newNamedFlexiTyVar :: FastString -> Kind -> TcM TcTyVar Source #

Create a new flexi ty var with a specific name

newFlexiTyVarTy :: Kind -> TcM TcType Source #

newFlexiTyVarTys :: Int -> Kind -> TcM [TcType] Source #

newOpenFlexiTyVar :: TcM TcTyVar Source #

newOpenFlexiTyVarTy :: TcM TcType Source #

Create a tyvar that can be a lifted or unlifted type. Returns alpha :: TYPE kappa, where both alpha and kappa are fresh

newOpenTypeKind :: TcM TcKind Source #

newOpenBoxedTypeKind :: TcM TcKind Source #

newMetaKindVar :: TcM TcKind Source #

newMetaKindVars :: Int -> TcM [TcKind] Source #

newMetaTyVarTyAtLevel :: TcLevel -> TcKind -> TcM TcType Source #

newAnonMetaTyVar :: MetaInfo -> Kind -> TcM TcTyVar Source #

newConcreteTyVar :: HasDebugCallStack => ConcreteTvOrigin -> TcKind -> TcM TcTyVar Source #

Create a new metavariable, of the given kind, which can only be unified with a concrete type.

Invariant: the kind must be concrete, as per Note [ConcreteTv]. This is checked with an assertion.

cloneMetaTyVar :: TcTyVar -> TcM TcTyVar Source #

newCycleBreakerTyVar :: TcKind -> TcM TcTyVar Source #

newMultiplicityVar :: TcM TcType Source #

readMetaTyVar :: TyVar -> TcM MetaDetails Source #

writeMetaTyVar :: HasDebugCallStack => TcTyVar -> TcType -> TcM () Source #

writeMetaTyVarRef :: HasDebugCallStack => TcTyVar -> TcRef MetaDetails -> TcType -> TcM () Source #

newTauTvDetailsAtLevel :: TcLevel -> TcM TcTyVarDetails Source #

newMetaDetails :: MetaInfo -> TcM TcTyVarDetails Source #

newMetaTyVarName :: FastString -> TcM Name Source #

isFilledMetaTyVar_maybe :: TcTyVar -> TcM (Maybe Type) Source #

isFilledMetaTyVar :: TyVar -> TcM Bool Source #

isUnfilledMetaTyVar :: TyVar -> TcM Bool Source #

newEvVar :: TcPredType -> TcRnIf gbl lcl EvVar Source #

newEvVars :: TcThetaType -> TcM [EvVar] Source #

newDict :: Class -> [TcType] -> TcM DictId Source #

newWantedWithLoc :: CtLoc -> PredType -> TcM CtEvidence Source #

Create a new Wanted constraint with the given `CtLoc`.

newWanted :: CtOrigin -> Maybe TypeOrKind -> PredType -> TcM CtEvidence Source #

Create a new Wanted constraint with the given `CtOrigin`, and location information taken from the `TcM` environment.

newWanteds :: CtOrigin -> ThetaType -> TcM [CtEvidence] Source #

Create new Wanted constraints with the given `CtOrigin`, and location information taken from the `TcM` environment.

cloneWanted :: Ct -> TcM Ct Source #

cloneWC :: WantedConstraints -> TcM WantedConstraints Source #

cloneWantedCtEv :: CtEvidence -> TcM CtEvidence Source #

emitWanted :: CtOrigin -> TcPredType -> TcM EvTerm Source #

Emits a new Wanted. Deals with both equalities and non-equalities.

emitWantedEq :: CtOrigin -> TypeOrKind -> Role -> TcType -> TcType -> TcM Coercion Source #

Emits a new equality constraint

emitWantedEvVar :: CtOrigin -> TcPredType -> TcM EvVar Source #

Creates a new EvVar and immediately emits it as a Wanted. No equality predicates here.

emitWantedEvVars :: CtOrigin -> [TcPredType] -> TcM [EvVar] Source #

emitWantedEqs :: CtOrigin -> [(TcType, TcType)] -> TcM () Source #

newTcEvBinds :: TcM EvBindsVar Source #

newNoTcEvBinds :: TcM EvBindsVar Source #

Creates an EvBindsVar incapable of holding any bindings. It still tracks covar usages (see comments on ebv_tcvs in GHC.Tc.Types.Evidence), thus must be made monadically

addTcEvBind :: EvBindsVar -> EvBind -> TcM () Source #

emitNewExprHole :: RdrName -> Type -> TcM HoleExprRef Source #

Emit a new wanted expression hole

newCoercionHole :: TcPredType -> TcM CoercionHole Source #

fillCoercionHole :: CoercionHole -> Coercion -> TcM () Source #

Put a value in a coercion hole

isFilledCoercionHole :: CoercionHole -> TcM Bool Source #

Is a coercion hole filled in?

unpackCoercionHole :: CoercionHole -> TcM Coercion Source #

Retrieve the contents of a coercion hole. Panics if the hole is unfilled

unpackCoercionHole_maybe :: CoercionHole -> TcM (Maybe Coercion) Source #

Retrieve the contents of a coercion hole, if it is filled

checkCoercionHole :: CoVar -> Coercion -> TcM Coercion Source #

Check that a coercion is appropriate for filling a hole. (The hole itself is needed only for printing.) Always returns the checked coercion, but this return value is necessary so that the input coercion is forced only when the output is forced.

type ConcreteHole = CoercionHole Source #

A coercion hole used to store evidence for `Concrete#` constraints.

See Note [The Concrete mechanism].

newConcreteHole Source #

Arguments

:: Kind | Kind of the thing we want to ensure is concrete (e.g. `runtimeRepTy`)
-> Type | Thing we want to ensure is concrete (e.g. some `RuntimeRep`)
-> TcM (ConcreteHole, TcType) | where to put the evidence, and a metavariable to store the concrete type

Create a new (initially unfilled) coercion hole, to hold evidence for a `'Concrete#' (ty :: ki)` constraint.

newImplication :: TcM Implication Source #

Create a new `Implication` with as many sensible defaults for its fields as possible. Note that the `ic_tclvl`, `ic_binds`, and `ic_info` fields do not have sensible defaults, so they are initialized with lazy thunks that will `panic` if forced, so one should take care to initialize these fields after creation.

This is monadic to look up the `TcLclEnv`, which is used to initialize `ic_env`, and to set the -Winaccessible-code flag. See Note [Avoid -Winaccessible-code when deriving] in GHC.Tc.TyCl.Instance.

newMetaTyVars :: [TyVar] -> TcM (Subst, [TcTyVar]) Source #

newMetaTyVarX :: Subst -> TyVar -> TcM (Subst, TcTyVar) Source #

newMetaTyVarsX :: Subst -> [TyVar] -> TcM (Subst, [TcTyVar]) Source #

newMetaTyVarTyVarX :: Subst -> TyVar -> TcM (Subst, TcTyVar) Source #

newTyVarTyVar :: Name -> Kind -> TcM TcTyVar Source #

cloneTyVarTyVar :: Name -> Kind -> TcM TcTyVar Source #

newPatSigTyVar :: Name -> Kind -> TcM TcTyVar Source #

newSkolemTyVar :: SkolemInfo -> Name -> Kind -> TcM TcTyVar Source #

newWildCardX :: Subst -> TyVar -> TcM (Subst, TcTyVar) Source #

data ExpType Source #

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

Constructors

Check TcType |
Infer !InferResult |

#### Instances

Instances details

Outputable ExpType Source # |
Instance details Defined in GHC.Tc.Utils.TcType Methods ppr :: ExpType -> SDoc Source #

type ExpSigmaType = ExpType Source #

type ExpRhoType = ExpType Source #

mkCheckExpType :: TcType -> ExpType Source #

Make an `ExpType` suitable for checking.

newInferExpType :: TcM ExpType Source #

newInferExpTypeFRR :: FixedRuntimeRepContext -> TcM ExpTypeFRR Source #

tcInfer :: (ExpSigmaType -> TcM a) -> TcM (a, TcSigmaType) Source #

Infer a type using a fresh ExpType See also Note [ExpType] in GHC.Tc.Utils.TcMType

Use `tcInferFRR` if you require the type to have a fixed runtime representation.

tcInferFRR :: FixedRuntimeRepContext -> (ExpSigmaTypeFRR -> TcM a) -> TcM (a, TcSigmaTypeFRR) Source #

Like `tcInfer`, except it ensures that the resulting type has a syntactically fixed RuntimeRep as per Note [Fixed RuntimeRep] in GHC.Tc.Utils.Concrete.

readExpType :: ExpType -> TcM TcType Source #

Extract a type out of an ExpType. Otherwise, panics.

readExpType_maybe :: ExpType -> TcM (Maybe TcType) Source #

Extract a type out of an ExpType, if one exists. But one should always exist. Unless you're quite sure you know what you're doing.

readScaledExpType :: Scaled ExpType -> TcM (Scaled Type) Source #

Same as readExpType, but for Scaled ExpTypes

expTypeToType :: ExpType -> TcM TcType Source #

Extracts the expected type if there is one, or generates a new TauTv if there isn't.

scaledExpTypeToType :: Scaled ExpType -> TcM (Scaled TcType) Source #

checkingExpType_maybe :: ExpType -> Maybe TcType Source #

Returns the expected type when in checking mode.

checkingExpType :: String -> ExpType -> TcType Source #

Returns the expected type when in checking mode. Panics if in inference mode.

inferResultToType :: InferResult -> TcM Type Source #

ensureMonoType :: TcType -> TcM () Source #

promoteTcType :: TcLevel -> TcType -> TcM (TcCoercionN, TcType) Source #

zonkTidyTcType :: TidyEnv -> TcType -> TcM (TidyEnv, TcType) Source #

zonkTidyTcTypes :: TidyEnv -> [TcType] -> TcM (TidyEnv, [TcType]) Source #

zonkTidyOrigin :: TidyEnv -> CtOrigin -> TcM (TidyEnv, CtOrigin) Source #

zonkTidyOrigins :: TidyEnv -> [CtOrigin] -> TcM (TidyEnv, [CtOrigin]) Source #

zonkTidyFRRInfos :: TidyEnv -> [FixedRuntimeRepErrorInfo] -> TcM (TidyEnv, [FixedRuntimeRepErrorInfo]) Source #

tidyEvVar :: TidyEnv -> EvVar -> EvVar Source #

tidyCt :: TidyEnv -> Ct -> Ct Source #

tidyHole :: TidyEnv -> Hole -> Hole Source #

tidyDelayedError :: TidyEnv -> DelayedError -> DelayedError Source #

zonkTcTyVar :: TcTyVar -> TcM TcType Source #

zonkTcTyVars :: [TcTyVar] -> TcM [TcType] Source #

zonkTcTyVarToTcTyVar :: HasDebugCallStack => TcTyVar -> TcM TcTyVar Source #

zonkTcTyVarsToTcTyVars :: HasDebugCallStack => [TcTyVar] -> TcM [TcTyVar] Source #

zonkInvisTVBinder :: VarBndr TcTyVar spec -> TcM (VarBndr TcTyVar spec) Source #

zonkTyCoVarsAndFV :: TyCoVarSet -> TcM TyCoVarSet Source #

zonkTcTypeAndFV :: TcType -> TcM DTyCoVarSet Source #

zonkDTyCoVarSetAndFV :: DTyCoVarSet -> TcM DTyCoVarSet Source #

zonkTyCoVarsAndFVList :: [TyCoVar] -> TcM [TyCoVar] Source #

zonkTcType :: TcType -> TcM TcType Source #

zonkTcTypes :: [TcType] -> TcM [TcType] Source #

zonkCo :: Coercion -> TcM Coercion Source #

zonkTyCoVarKind :: TyCoVar -> TcM TyCoVar Source #

zonkEvVar :: EvVar -> TcM EvVar Source #

zonkWC :: WantedConstraints -> TcM WantedConstraints Source #

zonkImplication :: Implication -> TcM Implication Source #

zonkSimples :: Cts -> TcM Cts Source #

zonkId :: TcId -> TcM TcId Source #

zonkCoVar :: CoVar -> TcM CoVar Source #

zonkCt :: Ct -> TcM Ct Source #

zonkSkolemInfo :: SkolemInfo -> TcM SkolemInfo Source #

zonkSkolemInfoAnon :: SkolemInfoAnon -> TcM SkolemInfoAnon Source #

defaultTyVar :: DefaultingStrategy -> TcTyVar -> TcM Bool Source #

Default a type variable using the given defaulting strategy.

See Note [Type variable defaulting options] in GHC.Types.Basic.

promoteMetaTyVarTo :: HasDebugCallStack => TcLevel -> TcTyVar -> TcM Bool Source #

promoteTyVarSet :: HasDebugCallStack => TcTyVarSet -> TcM Bool Source #

quantifyTyVars :: SkolemInfo -> NonStandardDefaultingStrategy -> CandidatesQTvs -> TcM [TcTyVar] Source #

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

zonkAndSkolemise :: SkolemInfo -> TcTyCoVar -> TcM TcTyCoVar Source #

skolemiseQuantifiedTyVar :: SkolemInfo -> TcTyVar -> TcM TcTyVar Source #

doNotQuantifyTyVars Source #

Arguments

:: CandidatesQTvs |
-> (TidyEnv -> TcM (TidyEnv, SDoc)) | like "the class context (D a b, E foogle)"
-> TcM () |

candidateQTyVarsOfType :: TcType -> TcM CandidatesQTvs Source #

Gathers free variables to use as quantification candidates (in `quantifyTyVars`). This might output the same var in both sets, if it's used in both a type and a kind. The variables to quantify must have a TcLevel strictly greater than the ambient level. (See Wrinkle in Note [Naughty quantification candidates]) See Note [CandidatesQTvs determinism and order] See Note [Dependent type variables]

candidateQTyVarsOfKind :: TcKind -> TcM CandidatesQTvs Source #

Like `candidateQTyVarsOfType`, but consider every free variable to be dependent. This is appropriate when generalizing a *kind*, instead of a type. (That way, -XNoPolyKinds will default the variables to Type.)

candidateQTyVarsOfTypes :: [Type] -> TcM CandidatesQTvs Source #

Like `candidateQTyVarsOfType`, but over a list of types The variables to quantify must have a TcLevel strictly greater than the ambient level. (See Wrinkle in Note [Naughty quantification candidates])

candidateQTyVarsOfKinds :: [TcKind] -> TcM CandidatesQTvs Source #

candidateQTyVarsWithBinders :: [TyVar] -> Type -> TcM CandidatesQTvs Source #

data CandidatesQTvs Source #

Constructors

DV |

Fields

- dv_kvs :: DTyVarSet
- dv_tvs :: DTyVarSet
- dv_cvs :: CoVarSet

#### Instances

Instances details

Monoid CandidatesQTvs Source # |
Instance details Defined in GHC.Tc.Utils.TcMType Methods mempty :: CandidatesQTvs Source # mappend :: CandidatesQTvs -> CandidatesQTvs -> CandidatesQTvs Source # mconcat :: [CandidatesQTvs] -> CandidatesQTvs Source #
Semigroup CandidatesQTvs Source # |
Instance details Defined in GHC.Tc.Utils.TcMType Methods (<>) :: CandidatesQTvs -> CandidatesQTvs -> CandidatesQTvs Source # sconcat :: NonEmpty CandidatesQTvs -> CandidatesQTvs Source # stimes :: Integral b => b -> CandidatesQTvs -> CandidatesQTvs Source #
Outputable CandidatesQTvs Source # |
Instance details Defined in GHC.Tc.Utils.TcMType Methods ppr :: CandidatesQTvs -> SDoc Source #

delCandidates :: CandidatesQTvs -> [Var] -> CandidatesQTvs Source #

candidateKindVars :: CandidatesQTvs -> TyVarSet Source #

partitionCandidates :: CandidatesQTvs -> (TyVar -> Bool) -> (TyVarSet, CandidatesQTvs) Source #

checkTypeHasFixedRuntimeRep :: FixedRuntimeRepProvenance -> Type -> TcM () Source #

Check that the specified type has a fixed runtime representation.

If it isn't, throw a representation-polymorphism error appropriate for the context (as specified by the `FixedRuntimeRepProvenance`).

Unlike the other representation polymorphism checks, which can emit new Wanted constraints to be solved by the constraint solver, this function does not emit any constraints: it has enough information to immediately make a decision.

See (1) in Note [Representation polymorphism checking] in GHC.Tc.Utils.Concrete

anyUnfilledCoercionHoles :: RewriterSet -> TcM Bool Source #

Check whether any coercion hole in a RewriterSet is still unsolved. Does this by recursively looking through filled coercion holes until one is found that is not yet filled in, at which point this aborts.