HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleghc-9.10.3GHC2021

GHC.Tc.Utils.TcMType

Monadic type operations

This module contains monadic operations over types that contain mutable type variables.

  • 10 types
  • 109 values
  • Packageghc-9.10.3
  • Exports119
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceTcMType.hs
typetype TcTyVar = Var
#

Type variable that might be a metavariable

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

Note: you should use newOpenFlexiFRRTyVarTy if you also need to ensure that the representation is concrete, in the sense of Note [Concrete types] in GHC.Tc.Utils.Concrete.

Check that a coercion is appropriate for filling a hole. (The hole itself is needed only for printing.) Always returns the checked coercion, but this return value is necessary so that the input coercion is forced only when the output is forced.

Create a new Implication with as many sensible defaults for its fields as possible. Note that the ic_tclvl, ic_binds, and ic_info fields do not have sensible defaults, so they are initialized with lazy thunks that will panic if forced, so one should take care to initialize these fields after creation.

This is monadic to look up the TcLclEnv, which is used to initialize ic_env, and to set the -Winaccessible-code flag. See Note [Avoid -Winaccessible-code when deriving] in GHC.Tc.TyCl.Instance.

valuetcCheckUsage :: Name -> Mult -> TcM a -> TcM (a, HsWrapper)
#

tcCheckUsage name mult thing_inside runs thing_inside, checks that the usage of name is a submultiplicity of mult, and removes name from the usage environment. See also Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify, which applies to the wrapper returned from this function.

Gathers free variables to use as quantification candidates (in quantifyTyVars). This might output the same var in both sets, if it's used in both a type and a kind. The variables to quantify must have a TcLevel strictly greater than the ambient level. (See Wrinkle in Note [Naughty quantification candidates]) See Note [CandidatesQTvs determinism and order] See Note [Dependent type variables]

Check that the specified type has a fixed runtime representation.

If it isn't, throw a representation-polymorphism error appropriate for the context (as specified by the FixedRuntimeRepProvenance).

Unlike the other representation polymorphism checks, which can emit new Wanted constraints to be solved by the constraint solver, this function does not emit any constraints: it has enough information to immediately make a decision.

See (1) in Note [Representation polymorphism checking] in GHC.Tc.Utils.Concrete

Other HsSyn functions

8 declarations