ghc-8.4.1.20180329: The GHC API

Safe HaskellNone
LanguageHaskell2010

TcType

Contents

Synopsis

Documentation

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 !InferResult 
Instances
Outputable ExpType Source # 
Instance details

Defined in TcType

data InferResult Source #

Constructors

IR 
Instances
Outputable InferResult Source # 
Instance details

Defined in TcType

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

newtype TcLevel Source #

Constructors

TcLevel Int 
Instances
Eq TcLevel Source # 
Instance details

Defined in TcType

Methods

(==) :: TcLevel -> TcLevel -> Bool #

(/=) :: TcLevel -> TcLevel -> Bool #

Ord TcLevel Source # 
Instance details

Defined in TcType

Outputable TcLevel Source # 
Instance details

Defined in TcType

data MetaDetails Source #

Constructors

Flexi 
Indirect TcType 
Instances
Outputable MetaDetails Source # 
Instance details

Defined in TcType

isFlattenTyVar :: TcTyVar -> Bool Source #

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

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

Make a sigma ty where all type variables are Inferred. That is, they cannot be used with visible type application.

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

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

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 TyBinders and the inner type. Always succeeds, even if it returns an empty list.

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

Splits a type into a TyBinder and a body, if possible. Panics otherwise

tcSplitForAllTyVarBndrs :: Type -> ([TyVarBinder], Type) Source #

Like tcSplitForAllTys, but splits off only named binders.

tcFunResultTyN :: HasDebugCallStack => Arity -> Type -> Type Source #

Strips off n *visible* arguments and returns the resulting type

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

Split off exactly the specified number argument types Returns (Left m) if there are m missing arrows in the type (Right (tys,res)) if the type looks like t1 -> ... -> tn -> res

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

Split a type constructor application into its type constructor and applied types. Note that this may fail in the case of a FunTy with an argument of unknown kind FunTy (e.g. FunTy (a :: k) Int. since the kind of a isn't of the form TYPE rep). Consequently, you may need to zonk your type before using this function.

If you only need the TyCon, consider using tcTyConAppTyCon_maybe.

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

Like tcSplitTyConApp_maybe but doesn't look through type synonyms.

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

Like tcRepSplitTyConApp_maybe, but returns Nothing if,

  1. the type is structurally not a type constructor application, or
  2. the type is a function type (e.g. application of funTyCon), but we currently don't even enough information to fully determine its RuntimeRep variables. For instance, FunTy (a :: k) Int.

By contrast tcRepSplitTyConApp_maybe panics in the second case.

The behavior here is needed during canonicalization; see Note [FunTy and decomposing tycon applications] in TcCanonical for details.

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)

tcRepGetNumAppTys :: Type -> Arity Source #

Returns the number of arguments in the given type, without looking through synonyms. This is used only for error reporting. We don't look through synonyms because of #11313.

tcGetCastedTyVar_maybe :: Type -> Maybe (TyVar, CoercionN) Source #

If the type is a tyvar, possibly under a cast, returns it, along with the coercion. Thus, the co is :: kind tv ~N kind type

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.

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

Split a sigma type into its parts, going underneath as many ForAllTys as possible. For example, given this type synonym:

type Traversal s t a b = forall f. Applicative f => (a -> f b) -> s -> f t

if you called tcSplitSigmaTy on this type:

forall s t a b. Each s t a b => Traversal s t a b

then it would return ([s,t,a,b], [Each s t a b], Traversal s t a b). But if you instead called tcSplitNestedSigmaTys on the type, it would return ([s,t,a,b,f], [Each s t a b, Applicative f], (a -> f b) -> s -> f t).

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

Type equality on source types. Does not look through newtypes or PredTypes, 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.

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

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 Bool Source #

Like tcEqType, but returns information about whether the difference is visible in the case of a mismatch. Nothing : the types are equal Just True : the types differ, and the point of difference is visible Just False : the types differ, and the point of difference is invisible

isRhoExpTy :: ExpType -> Bool Source #

Like isRhoTy, but also says True for Infer types

isFloatingTy :: Type -> Bool Source #

Does a type represent a floating-point number?

isStringTy :: Type -> Bool Source #

Is a type String?

isCallStackTy :: Type -> Bool Source #

Is a type a CallStack?

isCallStackPred :: Class -> [Type] -> Maybe FastString Source #

Is a PredType a CallStack implicit parameter?

If so, return the name of the parameter.

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?

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

Does the given tyvar appear at the head of a chain of applications (a t1 ... tn)

isInsolubleOccursCheck :: EqRel -> TcTyVar -> TcType -> Bool Source #

Is the equality a ~r ...a.... definitely insoluble or not? a ~r Maybe a -- Definitely insoluble a ~N ...(F a)... -- Not definitely insoluble -- Perhaps (F a) reduces to Int a ~R ...(N a)... -- Not definitely insoluble -- Perhaps newtype N a = MkN Int See Note [Occurs check error] in TcCanonical for the motivation for this function.

mkMinimalBySCs :: forall a. (a -> PredType) -> [a] -> [a] Source #

pickQuantifiablePreds :: TyVarSet -> 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]

Finding type instances

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

Finds outermost type-family applications occuring in a type, after expanding synonyms. In the list (F, tys) that is returned we guarantee that tys matches F's arity. For example, given type family F a :: * -> * (arity 1) calling tcTyFamInsts on (Maybe (F Int Bool) will return (F, [Int]), not (F, [Int,Bool])

This is important for its use in deciding termination of type instances (see Trac #11581). E.g. type instance G [Int] = ...(F Int type)... we don't need to take type into account when asking if the calls on the RHS are smaller than the LHS

isTyFamFree :: Type -> Bool Source #

Check that a type does not contain any type family applications.

Finding "exact" (non-dead) type variables

candidateQTyVarsOfType :: Type -> CandidatesQTvs Source #

Worker for splitDepVarsOfType. This might output the same var in both sets, if it's used in both a type and a kind. See Note [CandidatesQTvs determinism and order] See Note [Dependent type variables]

candidateQTyVarsOfTypes :: [Type] -> CandidatesQTvs Source #

Like splitDepVarsOfType, but over a list of types

Extracting bound variables

allBoundVariables :: Type -> TyVarSet Source #

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

type Kind = Type Source #

The key type representing kinds in the compiler.

isLiftedTypeKind :: Kind -> Bool Source #

This version considers Constraint to be distinct from *. Returns True if the argument is equivalent to Type and False otherwise.

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.

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 #

Instances
Data Type Source # 
Instance details

Defined in TyCoRep

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 Source # 
Instance details

Defined in TyCoRep

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 PredTypes

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 Note [TyBinders]

Instances
Data TyBinder Source # 
Instance details

Defined in TyCoRep

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 Source # 
Instance details

Defined in TyCoRep

data ArgFlag Source #

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 [TyVarBndrs, TyVarBinders, TyConBinders, and visibility] in TyCoRep

Constructors

Required 
Specified 
Inferred 
Instances
Eq ArgFlag Source # 
Instance details

Defined in Var

Methods

(==) :: ArgFlag -> ArgFlag -> Bool #

(/=) :: ArgFlag -> ArgFlag -> Bool #

Data ArgFlag Source # 
Instance details

Defined in Var

Methods

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 :: (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 #

Outputable ArgFlag Source # 
Instance details

Defined in Var

Binary ArgFlag Source # 
Instance details

Defined in Var

Outputable tv => Outputable (TyVarBndr tv ArgFlag) Source # 
Instance details

Defined in Var

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

Wraps foralls over the type using the provided TyVars from left to right

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

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

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

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

mkInvForAllTy :: TyVar -> Type -> Type Source #

Make a dependent forall over an Inferred (as opposed to Specified) variable

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

mkTyConTy :: TyCon -> Type Source #

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

isRuntimeRepVar :: TyVar -> Bool Source #

Is a tyvar of type RuntimeRep?

isKindLevPoly :: Kind -> Bool Source #

Tests whether the given kind (which should look like TYPE x) is something other than a constructor tree (that is, constructors at every node).

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.
Instances
Outputable TCvSubst Source # 
Instance details

Defined in TyCoRep

type TvSubstEnv = TyVarEnv Type Source #

A substitution of Types for TyVars and Kinds for KindVars

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!

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

Make a TCvSubst with specified tyvar subst and empty covar subst

substTy :: HasCallStack => TCvSubst -> Type -> Type Source #

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

substTys :: HasCallStack => TCvSubst -> [Type] -> [Type] Source #

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

substTyWith :: HasCallStack => [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 Types 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.

substTheta :: HasCallStack => TCvSubst -> ThetaType -> ThetaType Source #

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

isUnliftedType :: HasDebugCallStack => Type -> Bool Source #

See Type for what an unlifted type is. Panics on levity polymorphic types.

isPrimitiveType :: Type -> Bool Source #

Returns true of types that are opaque to Haskell.

tcView :: Type -> Maybe Type Source #

Gives the typechecker view of a type. This unwraps synonyms but leaves Constraint alone. c.f. coreView, which turns Constraint into TYPE LiftedRep. Returns Nothing if no unwrapping happens. See also Note [coreView vs tcView] in Type.

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. This function considers Constraint to be a synonym of TYPE LiftedRep.

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.

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.

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.

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 #

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.

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.

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.

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

Do a topological sort on a list of tyvars, so that binders occur before occurrences E.g. given [ a::k, k::*, b::k ] it'll return a well-scoped list [ k::*, a::k, b::k ]

This is a deterministic sorting operation (that is, doesn't depend on Uniques).

tcTyConVisibilities :: TyCon -> [Bool] Source #

For every arg a tycon can take, the returned list says True if the argument is taken visibly, and False otherwise. Ends with an infinite tail of Trues to allow for oversaturation.

isNextTyConArgVisible :: TyCon -> [Type] -> Bool Source #

If the tycon is applied to the types, is the next argument visible?

isNextArgVisible :: TcType -> Bool Source #

Should this type be applied to a visible argument?