Moduleghc-9.10.3GHC2021
GHC.Rename.HsType
- 4 types
- 44 values
- Packageghc-9.10.3
- Exports48
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceHsType.hs
Constructors
AlwaysBindAlways bind any free tyvars of the given type, regardless of whether we have a forall at the top.
For pattern type sigs, we do want to bring those type variables into scope, even if there's a forall at the top which usually stops that happening, e.g:
\ (x :: forall a. a -> b) -> eHere we do bring
binto scope.RULES can also use AlwaysBind, such as in the following example:
{-# RULES \"f\" forall (x :: forall a. a -> b). f x = ... b ... #-}This only applies to RULES that do not explicitly bind their type variables. If a RULE explicitly quantifies its type variables, then NeverBind is used instead. See also
Note [Pattern signature binders and scoping]in GHC.Hs.Type.NeverBindNever bind any free tyvars. This is used for RULES that have both explicit type and term variable binders, e.g.:
{-# RULES \"const\" forall a. forall (x :: a) y. const x y = x #-}The presence of the type variable binder
forall a.implies that the free variables in the types of the term variable bindersxandyare not bound. In the example above, there are no such free variables, but if the user had written(y :: b)instead ofyin the term variable binders, thenbwould be rejected for being out of scope. See alsoNote [Pattern signature binders and scoping]in GHC.Hs.Type.
bindHsOuterTyVarBndrs :: OutputableBndrFlag flag 'Renamed=> HsDocContext-> Maybe assocJust _=> an associated type decl-> FreeKiTyVars-> HsOuterTyVarBndrs flag GhcPs-> (HsOuterTyVarBndrs flag GhcRn -> RnM (a, FreeVars))-> RnM (a, FreeVars)
Should GHC warn if a quantified type variable goes unused? Usually, the
answer is "yes", but in the particular case of binding LHsQTyVars, we
avoid emitting warnings.
See Note [Suppress -Wunused-foralls when binding LHsQTyVars].
Instances1Outputable
Outputable WarnUnusedForallsDefined in ghc-9.10.3 · GHC.Rename.HsType
rnImplicitTvOccs Create new renamed type variables corresponding to source-level ones. Duplicates are permitted, but will be removed. This is intended especially for the case of handling the implicitly bound free variables of a type signature.
Filter out any type and kind variables that are already in scope in the the environment's LocalRdrEnv. Note that this includes named wildcards, which look like perfectly ordinary type variables at this point.
extractHsTyRdrTyVars finds the type/kind variables
of a HsType/HsKind.
It's used when making the foralls explicit.
See Note [Kind and type-variable binders]
Extracts the free type/kind variables from the kind signature of a HsType.
This is used to implicitly quantify over k in type T = Nothing :: Maybe k.
The left-to-right order of variables is preserved.
See Note [Kind and type-variable binders] and
Note [Ordering of implicit variables] and
Note [Implicit quantification in type synonyms].
Extracts free type and kind variables from types in a list. When the same name occurs multiple times in the types, all occurrences are returned.
Extracts free type and kind variables from an argument in a GADT
constructor, returning variable occurrences in left-to-right order.
See Note [Ordering of implicit variables].
Get type/kind variables mentioned in the kind signature, preserving left-to-right order:
data T a (b :: k1) :: k2 -> k1 -> k2 -> Type -- result: [k2,k1]
data T a (b :: k1) -- result: []
See Note [Ordering of implicit variables].