Note [Variable Specificity and Forall Visibility]
A HsForAllTy contains an HsForAllTelescope to denote the visibility of the forall
binder. Furthermore, each invisible type variable binder also has a
Specificity. Together, these determine the variable binders (ForAllTyFlag) for each
variable in the generated ForAllTy type.
This table summarises this relation:
| User-written type HsForAllTelescope Specificity ForAllTyFlag
|---------------------------------------------------------------------------
| f :: forall a. type HsForAllInvis SpecifiedSpec Specified
| f :: forall {a}. type HsForAllInvis InferredSpec Inferred
| f :: forall a -> type HsForAllVis SpecifiedSpec Required
| f :: forall {a} -> type HsForAllVis InferredSpec /
| This last form is nonsensical and is thus rejected.
For more information regarding the interpretation of the resulting ForAllTyFlag, see
Note [VarBndrs, ForAllTyBinders, TyConBinders, and visibility] in "GHC.Core.TyCo.Rep". References 1
- VarBndrs, ForAllTyBinders, TyConBinders, and visibility GHC.Types.Var
Referenced by 1
- Language.Haskell.Syntax.Type call site