Moduleghc-lib-parser-9.14.1.20251220GHC2021
GHC.Core.TyCo.FVs
- 1 type
- 52 values
- Packageghc-lib-parser-9.14.1.20251220
- Exports53
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceFVs.hs
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 GHC.Utils.FV.
Returns free variables of types, including kind variables as a deterministic set. For type synonyms it does not expand the synonym.
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 GHC.Utils.FV.
Eta-expanded because that makes it run faster (apparently) See Note [FV eta expansion] in GHC.Utils.FV for explanation.
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 GHC.Utils.FV.
Returns free variables of types, including kind variables as a deterministically ordered list. For type synonyms it does not expand the synonym.
Returns free variables of types, including kind variables as a non-deterministic set. For type synonyms it does not expand the synonym.
Get a deterministic set of the vars free in a coercion
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 (FC6) in Note [ForAllCo] in GHC.Core.TyCo.Rep
injectiveVarsOfType Returns the free variables of a Type that are in injective positions. Specifically, it finds the free variables while:
Expanding type synonyms
Ignoring the coercion in
(ty |> co)Ignoring the non-injective fields of a TyConApp
For example, if F is a non-injective type family, then:
injectiveTyVarsOf( Either c (Maybe (a, F b c)) ) = {a,c}
If injectiveVarsOfType ty = itvs, then knowing ty fixes itvs.
More formally, if
a is in injectiveVarsOfType ty
and S1(ty) ~ S2(ty),
then S1(a) ~ S2(a),
where S1 and S2 are arbitrary substitutions.
See Note [When does a tycon application need an explicit kind signature?].
injectiveVarsOfTypes Returns the set of variables that are used invisibly anywhere within the given type. A variable will be included even if it is used both visibly and invisibly. An invisible use site includes: * In the kind of a variable * In the kind of a bound variable in a forall * In a coercion * In a Specified or Inferred argument to a function See Note [VarBndrs, ForAllTyBinders, TyConBinders, and visibility] in GHC.Core.TyCo.Rep
Like invisibleVarsOfType, but for many types.
Free type constructors
2 declarationsAll type constructors occurring in the type; looking through type synonyms, but not newtypes. When it finds a Class, it returns the class TyCon.
Free vars with visible/invisible separate
2 declarationsRetrieve the free variables in this type, splitting them based on whether they are used visibly or invisibly. Invisible ones come first.
Occurrence-check expansion
1 declarationClosing over kinds
3 declarationsAdd the kind variables free in the kinds of the tyvars in the given set. Returns a deterministic set.
Add the kind variables free in the kinds of the tyvars in the given set. Returns a deterministically ordered list.
Raw materials
2 declarationsThe monoid of endomorphisms under composition.
Endo f <> Endo g == Endo (f . g)Examples
let computation = Endo ("Hello, " ++) <> Endo (++ "!")appEndo computation "Haskell""Hello, Haskell!"
let computation = Endo (*3) <> Endo (+1)appEndo computation 16
Instances4Generic, Semigroup, Monoid, Rep
Generic (Endo a)Defined in ghc-internal-10.0.0 · GHC.Internal.GenericsSemigroup (Endo a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.InternalMonoid (Endo a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internaltype Rep (Endo a) = D1 ('MetaDataDefined in ghc-internal-10.0.0 · GHC.Internal.Generics"Endo"
"GHC.Internal.Data.Semigroup.Internal"
"ghc-internal"
'True) (C1 ('MetaCons"Endo"
'PrefixI 'True) (S1 ('MetaSel ('Just"appEndo"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a -> a))))