ghc-8.2.2: The GHC API

Safe HaskellNone
LanguageHaskell2010

TcMType

Synopsis

Documentation

type TcTyVar = TyVar #

type TcKind = Kind #

type TcType = Type #

newOpenFlexiTyVarTy :: TcM TcType #

Create a tyvar that can be a lifted or unlifted type. Returns alpha :: TYPE kappa, where both alpha and kappa are fresh

data ExpType #

An expected type to check against during type-checking. See Note [ExpType] in TcMType, where you'll also find manipulators.

Constructors

Check TcType 
Infer !InferResult 

Instances

mkCheckExpType :: TcType -> ExpType #

Make an ExpType suitable for checking.

newInferExpTypeNoInst :: TcM ExpSigmaType #

Make an ExpType suitable for inferring a type of kind * or #.

readExpType :: ExpType -> TcM TcType #

Extract a type out of an ExpType. Otherwise, panics.

readExpType_maybe :: ExpType -> TcM (Maybe TcType) #

Extract a type out of an ExpType, if one exists. But one should always exist. Unless you're quite sure you know what you're doing.

expTypeToType :: ExpType -> TcM TcType #

Extracts the expected type if there is one, or generates a new TauTv if there isn't.

checkingExpType_maybe :: ExpType -> Maybe TcType #

Returns the expected type when in checking mode.

checkingExpType :: String -> ExpType -> TcType #

Returns the expected type when in checking mode. Panics if in inference mode.

tauifyExpType :: ExpType -> TcM ExpType #

Turn a (Infer hole) type into a (Check alpha), where alpha is a fresh unification variable

emitWanted :: CtOrigin -> TcPredType -> TcM EvTerm #

Emits a new Wanted. Deals with both equalities and non-equalities.

emitWantedEq :: CtOrigin -> TypeOrKind -> Role -> TcType -> TcType -> TcM Coercion #

Emits a new equality constraint

emitWantedEvVar :: CtOrigin -> TcPredType -> TcM EvVar #

Creates a new EvVar and immediately emits it as a Wanted. No equality predicates here.

fillCoercionHole :: CoercionHole -> Coercion -> TcM () #

Put a value in a coercion hole

isFilledCoercionHole :: CoercionHole -> TcM Bool #

Is a coercion hole filled in?

unpackCoercionHole :: CoercionHole -> TcM Coercion #

Retrieve the contents of a coercion hole. Panics if the hole is unfilled

unpackCoercionHole_maybe :: CoercionHole -> TcM (Maybe Coercion) #

Retrieve the contents of a coercion hole, if it is filled

checkCoercionHole :: Coercion -> CoercionHole -> Role -> Type -> Type -> TcM Coercion #

Check that a coercion is appropriate for filling a hole. (The hole itself is needed only for printing. NB: This must be lazy in the coercion, as it's used in TcHsSyn in the presence of knots. Always returns the checked coercion, but this return value is necessary so that the input coercion is forced only when the output is forced.

tcInstType #

Arguments

:: ([TyVar] -> TcM (TCvSubst, [TcTyVar]))

How to instantiate the type variables

-> Id

Type to instantiate

-> TcM ([(Name, TcTyVar)], TcThetaType, TcType)

Result (type vars, preds (incl equalities), rho)

tcInstSkolTyVars :: [TyVar] -> TcM (TCvSubst, [TcTyVar]) #

Given a list of [TyVar], skolemize the type variables, returning a substitution mapping the original tyvars to the skolems, and the list of newly bound skolems. See also tcInstSkolTyVars' for a precondition. The resulting skolems are non-overlappable; see Note [Overlap and deriving] for an example where this matters.

instSkolTyCoVars :: TcTyVarMaker -> [TyVar] -> TcRnIf gbl lcl (TCvSubst, [TyCoVar]) #

freshenTyVarBndrs :: [TyVar] -> TcRnIf gbl lcl (TCvSubst, [TyVar]) #

Give fresh uniques to a bunch of TyVars, but they stay as TyVars, rather than becoming TcTyVars Used in FamInst.newFamInst, and Inst.newClsInst

freshenCoVarBndrsX :: TCvSubst -> [CoVar] -> TcRnIf gbl lcl (TCvSubst, [CoVar]) #

Give fresh uniques to a bunch of CoVars Used in FamInst.newFamInst

mkTypeErrorThing :: TcType -> ErrorThing #

Make an ErrorThing storing a type.

mkTypeErrorThingArgs :: TcType -> Int -> ErrorThing #

Make an ErrorThing storing a type, with some extra args known about

tidyCt :: TidyEnv -> Ct -> Ct #

zonkTcTypeAndSplitDepVars :: TcType -> TcM CandidatesQTvs #

Zonk a type and call candidateQTyVarsOfType on it. Works within the knot.

zonkCo :: Coercion -> TcM Coercion #

Zonk a coercion -- really, just zonk any types in the coercion

zonkTcTypeMapper :: TyCoMapper () TcM #

A suitable TyCoMapper for zonking a type inside the knot, and before all metavars are filled in.

zonkCt :: Ct -> TcM Ct #

tcGetGlobalTyCoVars :: TcM TcTyVarSet #

tcGetGlobalTyCoVars returns a fully-zonked set of *scoped* tyvars free in the environment. To improve subsequent calls to the same function it writes the zonked set back into the environment. Note that this returns all variables free in anything (term-level or type-level) in scope. We thus don't have to worry about clashes with things that are not in scope, because if they are reachable, then they'll be returned here.

ensureNotLevPoly :: Type -> SDoc -> TcM () #

According to the rules around representation polymorphism (see https://ghc.haskell.org/trac/ghc/wiki/NoSubKinds), no binder can have a representation-polymorphic type. This check ensures that we respect this rule. It is a bit regrettable that this error occurs in zonking, after which we should have reported all errors. But it's hard to see where else to do it, because this can be discovered only after all solving is done. And, perhaps most importantly, this isn't really a compositional property of a type system, so it's not a terrible surprise that the check has to go in an awkward spot.

checkForLevPolyX :: Monad m => (SDoc -> m ()) -> SDoc -> Type -> m () #