HORIZON HASKELLDocslts/ghc-10.0.x8174fa42026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Moduleghc-lib-parser-9.14.1.20251220GHC2021

GHC.Core.TyCo.Rep

  • 27 types
  • 35 values

Types

14 declarations
datadata Type
#

Constructors

  • TyVarTy Var

    Vanilla type or kind variable (*never* a coercion variable)

  • AppTy Type Type

    Type application to something other than a TyCon. Parameters:

    1) Function: must not be a TyConApp or CastTy, must be another AppTy, or TyVarTy See Note [Respecting definitional equality] (EQ1) about the no CastTy requirement

    2) Argument type

  • TyConApp TyCon [KindOrType]

    Application of a TyCon, including newtypes and synonyms. Invariant: saturated applications of FunTyCon must use FunTy and saturated synonyms must use their own constructors. However, unsaturated FunTyCons do appear as TyConApps. Parameters:

    1) Type constructor being applied to.

    2) Type arguments. Might not have enough type arguments here to saturate the constructor. Even type synonyms are not necessarily saturated; for example unsaturated type synonyms can appear as the right hand side of a type synonym.

  • ForAllTy !ForAllTyBinder Type
  • FunTy

    FUN m t1 t2 Very common, so an important special case See Note [Function types]

  • LitTy TyLit

    Type literals are similar to type constructors.

  • CastTy Type KindCoercion

    A kind cast. The coercion is always nominal. INVARIANT: The cast is never reflexive (EQ2) INVARIANT: The Type is not a CastTy (use TransCo instead) (EQ3) INVARIANT: The Type is not a ForAllTy over a tyvar (EQ4) See Note [Respecting definitional equality]

  • CoercionTy Coercion

    Injection of a Coercion into a type This should only ever be used in the RHS of an AppTy, in the list of a TyConApp, when applying a promoted GADT data constructor

Instances3Data, Outputable, Eq
  • Data TypeDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • Outputable TypeDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • Eq (DeBruijn Type)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.Map.Type
typetype KindOrType = Type
#

The key representation of types within the compiler

typetype Kind = Type
#

The key type representing kinds in the compiler.

typetype LevityType = Type
#

Type synonym used for types of kind Levity.

typetype KnotTied (ty :: k) = ty
#

A type labeled KnotTied might have knot-tied tycons in it. See Note [Type checking recursive type and class declarations] in GHC.Tc.TyCl

typetype PredType = Type
#

A type of the form p of constraint kind represents a value whose type is the Haskell predicate p, where a predicate is what occurs before the => in a Haskell type.

We use PredType as documentation to mark those types that we guarantee to have this kind.

It can be expanded into its representation, but:

  • The type checker must treat it as opaque

  • The rest of the compiler treats it as transparent

Consider these examples:

f :: (Eq a) => a -> Int
g :: (?x :: Int -> Int) => a -> Int
h :: (r\l) => {r} => {l::Int | r}

Here the Eq a and ?x :: Int -> Int and rl are all called "predicates"

datadata ForAllTyFlag
#

ForAllTyFlag

Is something required to appear in source Haskell (Required), permitted by request (Specified) (visible type application), or prohibited entirely from appearing in source Haskell (Inferred)? See Note [VarBndrs, ForAllTyBinders, TyConBinders, and visibility] in GHC.Core.TyCo.Rep

Instances8Eq, Data, Ord, NFData, Binary, OutputableBndrFlag, …
datadata FunTyFlag
#

The non-dependent version of ForAllTyFlag. See Note [FunTyFlag] Appears here partly so that it's together with its friends ForAllTyFlag and ForallVisFlag, but also because it is used in IfaceType, rather early in the compilation chain

Instances6Eq, Data, Ord, NFData, Outputable, Binary
  • Eq FunTyFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Var
  • Data FunTyFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Var
  • Ord FunTyFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Var
  • NFData FunTyFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Var
  • Outputable FunTyFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Var
  • Binary FunTyFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Var

Coercions

14 declarations
datadata Coercion
#
Instances3Data, Outputable, Eq
  • Data CoercionDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • Outputable CoercionDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • Eq (DeBruijn Coercion)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.Map.Type
datadata CoSel
#
Instances6Eq, Data, Ord, NFData, Outputable, Binary
  • Eq CoSelDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • Data CoSelDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • Ord CoSelDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • NFData CoSelDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • Outputable CoSelDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • Binary CoSelDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
datadata FunSel
#
Instances5Eq, Data, Ord, NFData, Outputable
  • Eq FunSelDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • Data FunSelDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • Ord FunSelDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • NFData FunSelDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
  • Outputable FunSelDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.TyCo.Rep
datadata UnivCoProvenance
#

For simplicity, we have just one UnivCo that represents a coercion from some type to some other type, with (in general) no restrictions on the type. The UnivCoProvenance specifies more exactly what the coercion really is and why a program should (or shouldn't!) trust the coercion. It is reasonable to consider each constructor of UnivCoProvenance as a totally independent coercion form; their only commonality is that they don't tell you what types they coercion between. (That info is in the UnivCo constructor of Coercion.

Constructors

  • PhantomProv

    See Note [Phantom coercions]. Only in Phantom roled coercions

  • ProofIrrelProv

    From the fact that any two coercions are considered equivalent. See Note [ProofIrrelProv]. Can be used in Nominal or Representational coercions

  • PluginProv String

    From a plugin, which asserts that this coercion is sound. The string and the variable set are for the use by the plugin.

Instances6Eq, Data, Ord, NFData, Outputable, Binary

Functions over types

24 declarations
valuemkNakedTyConTy :: TyCon -> Type
#

mkNakedTyConTy creates a nullary TyConApp. In general you should rather use GHC.Core.Type.mkTyConTy, which picks the shared nullary TyConApp from inside the TyCon (via tyConNullaryTy. But we have to build the TyConApp tc [] in that TyCon field; that's what mkNakedTyConTy is for.

valuemkForAllTy :: ForAllTyBinder -> Type -> Type
#

Like mkTyCoForAllTy, but does not check the occurrence of the binder See Note [Unused coercion variable in ForAllTy]

Functions over coercions

1 declaration

Analyzing types

Sizes

3 declarations

Multiplicities

5 declarations
datadata Scaled a
#

A shorthand for data with an attached Mult element (the multiplicity).

Constructors

Instances2Data, Outputable
typetype Mult = Type
#

Mult is a type alias for Type.

Mult must contain Type because multiplicity variables are mere type variables (of kind Multiplicity) in Haskell. So the simplest implementation is to make Mult be Type.

Multiplicities can be formed with: - One: GHC.Types.One (= oneDataCon) - Many: GHC.Types.Many (= manyDataCon) - Multiplication: GHC.Types.MultMul (= multMulTyCon)

So that Mult feels a bit more structured, we provide pattern synonyms and smart constructors for these.