ghc-8.0.1: The GHC API

Safe HaskellNone
LanguageHaskell2010

TcHsType

Synopsis

Documentation

tcHsTypeApp :: LHsWcType Name -> Kind -> TcM Type Source #

Type-check a visible type application

tcImplicitTKBndrsType :: [Name] -> TcM Type -> TcM ([TcTyVar], Type) Source #

Convenient specialization

tcExplicitTKBndrs Source #

Arguments

:: [LHsTyVarBndr Name] 
-> ([TyVar] -> TcM (a, TyVarSet))

Thing inside returns the set of variables bound in the scope. See Note [Scope-check inferred kinds]

-> TcM (a, TyVarSet)

returns augmented bound vars No cloning: returned TyVars have the same Name as the incoming LHsTyVarBndrs

kcTyClTyVars Source #

Arguments

:: Name

of the tycon

-> LHsQTyVars Name 
-> TcM a 
-> TcM a 

"Kind check" the tyvars to a tycon. This is used during the "kind-checking" pass in TcTyClsDecls. (Never in getInitialKind, never in the "type-checking"/desugaring pass.) It works only for LHsQTyVars associated with a tycon, whose kind is known (partially) via getInitialKinds. Never emits constraints, though the thing_inside might.

tcTyClTyVars :: Name -> LHsQTyVars Name -> ([TyVar] -> [TyVar] -> [TyBinder] -> Kind -> TcM a) -> TcM a Source #

Used for the type variables of a type or class decl on the second full pass (type-checking/desugaring) in TcTyClDecls. This is *not* used in the initial-kind run, nor in the "kind-checking" pass. Accordingly, everything passed to the continuation is fully zonked.

(tcTyClTyVars T [a,b] thing_inside) where T : forall k1 k2 (a:k1 -> *) (b:k1). k2 -> * calls thing_inside with arguments [k1,k2] [a,b] [k1:*, k2:*, a:k1 -> *, b:k1] (k2 -> *) having also extended the type environment with bindings for k1,k2,a,b

Never emits constraints.

The LHsTyVarBndrs is always user-written, and the full, generalised kind of the tycon is available in the local env.

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

kcHsTyVarBndrs Source #

Arguments

:: Bool

True = the decl being checked has a CUSK

-> Bool

True = the decl is an open type/data family

-> Bool

True = all the hsq_implicit are *kind* vars (will give these kind * if -XNoTypeInType)

-> LHsQTyVars Name 
-> TcM (Kind, r)

the result kind, possibly with other info

-> TcM ([TcTyBinder], TcKind, r)

The bound variables in the kind, the result kind, with the other info. Always returns Named binders; sort out Named vs. Anon yourself.

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 also Note [Complete user-supplied kind signatures] in HsDecls.

This function does not do telescope checking.

tcInferApps Source #

Arguments

:: Outputable fun 
=> TcTyMode 
-> fun

Function (for printing only)

-> TcType

Function (could be knot-tied)

-> TcKind

Function kind (zonked)

-> [LHsType Name]

Args

-> TcM (TcType, TcKind)

(f args, result kind)

Applies a type to a list of arguments. Always consumes all the arguments.

tcInferArgs Source #

Arguments

:: Outputable fun 
=> fun

the function

-> [TyBinder]

function kind's binders

-> Maybe (VarEnv Kind)

possibly, kind info (see above)

-> [LHsType Name]

args

-> TcM (TCvSubst, [TyBinder], [TcType], [LHsType Name], Int)

(instantiating subst, un-insted leftover binders, typechecked args, untypechecked args, n)

Apply a type of a given kind to a list of arguments. This instantiates invisible parameters as necessary. However, it does *not* necessarily apply all the arguments, if the kind runs out of binders. 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. This version will instantiate all invisible arguments left over after the visible ones.

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.

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.