ghc-lib-0.20190523.1: The GHC API, decoupled from GHC versions

TcHsType

Synopsis

# Documentation

Arguments

 :: Maybe (DerivStrategy GhcRn) The deriving strategy -> TcM ([TyVar], a) The thing to typecheck within the context of the deriving strategy, which might quantify some type variables of its own. -> TcM (Maybe (DerivStrategy GhcTc), [TyVar], a) The typechecked deriving strategy, all quantified tyvars, and the payload of the typechecked thing.

Typecheck something within the context of a deriving strategy. This is of particular importance when the deriving strategy is via. For instance:

deriving via (S a) instance C (T a)


We need to typecheck S a, and moreover, we need to extend the tyvar environment with a before typechecking C (T a), since S a quantified the type variable a.

Type-check a visible type application

Describes the kind expected in a certain context.

Constructors

 TheKind Kind a specific kind AnyKind any kind will do OpenKind something of the form TYPE _

bindTyClTyVars :: Name -> ([TyConBinder] -> Kind -> TcM a) -> TcM a Source #

Used for the type variables of a type or class decl in the "kind checking" and "type checking" pass, but not in the initial-kind run.

Arguments

 :: Name of the thing being checked -> TyConFlavour What sort of TyCon is being checked -> Bool True = the decl being checked has a CUSK -> LHsQTyVars GhcRn -> TcM Kind The result kind -> TcM TcTyCon A suitably-kinded TcTyCon

Kind-check a LHsQTyVars. If the decl under consideration has a complete, user-supplied kind signature (CUSK), generalise the result. Used in getInitialKind (for tycon kinds and other kinds) and in kind-checking (but not for tycon kinds, which are checked with tcTyClDecls). See Note [CUSKs: complete user-supplied kind signatures] in HsDecls.

This function does not do telescope checking.

tcWildCardBinders :: [Name] -> ([(Name, TcTyVar)] -> TcM a) -> TcM a Source #

Arguments

 :: TcTyMode -> LHsType GhcRn Function (for printing only) -> TcType Function -> [LHsTypeArg GhcRn] Args -> TcM (TcType, TcKind) (f args, args, result kind)

Apply a type of a given kind to a list of arguments. This instantiates invisible parameters as necessary. Always consumes all the arguments, using matchExpectedFunKind as necessary. This takes an optional VarEnv Kind which maps kind variables to kinds.- These kinds should be used to instantiate invisible kind variables; they come from an enclosing class for an associated type/data family.

tcInferApps also arranges to saturate any trailing invisible arguments of a type-family application, which is usually the right thing to do tcInferApps_nosat does not do this saturation; it is used only by ":kind" in GHCi

If the inner action emits constraints, report them as errors and fail; otherwise, propagates the return value. Useful as a wrapper around tcImplicitTKBndrs, which uses solveLocalEqualities, when there won't be another chance to solve constraints

solveEqualities :: TcM a -> TcM a Source #

Type-check a thing that emits only equality constraints, then solve those constraints. Fails outright if there is trouble. Use this if you're not going to get another crack at solving (because, e.g., you're checking a datatype declaration)

typeLevelMode :: TcTyMode Source #

kindLevelMode :: TcTyMode Source #

Arguments

 :: HasDebugCallStack => SDoc The thing we are checking -> TcType type we're checking -> TcKind the known kind of that type -> TcKind the expected kind -> TcM TcType

Whenever a type is about to be added to the environment, it's necessary to make sure that any free meta-tyvars in the type are promoted to the current TcLevel. (They might be at a higher level due to the level-bumping in tcExplicitTKBndrs, for example.) This function both zonks *and* promotes. Why at the same time? See Note [Recipe for checking a signature]

funAppCtxt :: (Outputable fun, Outputable arg) => fun -> arg -> Int -> SDoc Source #

Make an appropriate message for an error in a function argument. Used for both expressions and types.

Add a "In the data declaration for T" or some such.