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

GHC 10.0.0.20260917 · lts/ghc-10.0.x · aa25b89 · 2026-10-10

Moduleghc-10.0.0.20260917GHC2024

GHC.Hs.Type

  • 55 types
  • 1 class
  • 88 values
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.

datadata HsFunArr pass
#

Denotes a function arrow, which could be -> or ⊸ or ::. :: counts as an "arrow" for these purposes, because in HsConDeclField we need to support both

data T where MkT :: Int -> Bool -> T
data T where MkT :: { x :: Int, y :: Bool } -> T

Constructors

Instances3Data
datadata HsModifiedFunArrOf mult pass
#

Denotes function arrows with optional modifiers attached.

The mult type argument is usually `LHsType (NoGhcTc pass)`, but when the annotation is part of a type used in a term, it is `LHsExpr pass`. See Note [Types in terms].

Constructors

Instances7Data, ToHie, …
datadata HsType pass
#

Haskell Type

Constructors

Instances20Outputable, ToHie, DisambTD, HasHaddock, Data, Anno, …
datadata HsForAllTelescope pass
#

The type variable binders in an HsForAllTy. See also Note [Variable Specificity and Forall Visibility] in GHC.Tc.Gen.HsType.

Constructors

Instances4Data, Outputable
datadata HsTyVarBndr flag pass
#

Haskell Type Variable Binder See Note [Type variable binders]

Instances9ToHie, Data, Outputable, Anno, …
datadata HsBndrVar pass
#

Constructors

Instances4Data, Outputable
datadata HsBndrVis pass
#
Instances6CvtFlag, Data, OutputableBndrFlag, RepTV
datadata LHsQTyVars pass
#

Located Haskell Quantified Type Variables

Instances5Data, Outputable, ToHie
datadata HsOuterTyVarBndrs flag pass
#

The outermost type variables in a type that obeys the forall-or-nothing rule. See Note [forall-or-nothing rule].

Constructors

Instances6ToHie, Data, Outputable, Anno
datadata HsWildCardBndrs pass thing
#

Haskell Wildcard Binders

Constructors

Instances7ToHie, Data, Outputable, HasHaddock, …
datadata HsPatSigType pass
#

Types that can appear in pattern signatures, as well as the signatures for term-level binders in RULES. See Note [Pattern signature binders and scoping].

This is very similar to HsSigWcType, but with slightly different semantics: see Note [HsType binders]. See also Note [The wildcard story for types].

Constructors

Instances5Data, Outputable, ToHie
datadata HsPSRn
#

The extension field for HsPatSigType, which is only used in the renamer onwards. See Note [Pattern signature binders and scoping].

Constructors

Instances1Data
  • Data HsPSRnDefined in ghc-10.0.0.20260917 · GHC.Hs.Type
datadata HsTyPat pass
#

Constructors

Instances5Data, Outputable, ToHie
datadata HsTyPatRnBuilder
#

A variant of HsTyPatRn that uses Bags for efficient concatenation. See Note [Implicit and explicit type variable binders] in GHC.Rename.Pat

Instances4Generic, Semigroup, Monoid, Rep
datadata HsSigType pass
#

A type signature that obeys the forall-or-nothing rule. In other words, an LHsType that uses an HsOuterSigTyVarBndrs to represent its outermost type variable quantification. See Note [Representing type signatures].

Instances8Data, Outputable, ToHie, HasHaddock, Anno, …
datadata HsModifierOf ty pass
#

Modifier. Usually a modifier holds an LHsType, but inside expressions, it has an LHsExpr. See Note [Overview of Modifiers].

Constructors

Instances9Data, ToHie, Anno, …
datadata HsLit x
#

Haskell Literal

Constructors

Instances5Eq, Data, Outputable
newtypenewtype HsIPName
#

These names are used early on to store the names of implicit parameters. They completely disappear after type-checking.

Constructors

Instances6Eq, Data, Outputable, OutputableBndr, ToHie, Anno
datadata HsArg p tm ty
#

Arguments in an expression/type after splitting

Constructors

Instances6Data, HasLoc, Outputable, ToHie
valuepprHsArgsApp
  1. :: (OutputableBndr id, Outputable tm, Outputable ty)
  2. => id
  3. -> LexicalFixity
  4. -> [HsArg (GhcPass p) tm ty]
  5. -> SDoc
#

pprHsArgsApp id fixity args pretty-prints an application of id to args, using the fixity to tell whether id should be printed prefix or infix. Examples:

pprHsArgsApp T Prefix [HsTypeArg Bool, HsValArg Int]                        = T @Bool Int
pprHsArgsApp T Prefix [HsTypeArg Bool, HsArgPar, HsValArg Int]              = (T @Bool) Int
pprHsArgsApp (++) Infix [HsValArg Char, HsValArg Double]                    = Char ++ Double
pprHsArgsApp (++) Infix [HsValArg Char, HsValArg Double, HsVarArg Ordering] = (Char ++ Double) Ordering
datadata HsSrcBang
#

Haskell Source Bang

Bangs on data constructor arguments as written by the user, including the source code for exact-printing.

(HsSrcBang _ SrcUnpack SrcLazy) and (HsSrcBang _ SrcUnpack NoSrcStrict) (without StrictData) makes no sense, we emit a warning (in checkValidDataCon) and treat it like (HsSrcBang _ NoSrcUnpack SrcLazy)

In the AST, the SourceText is hidden inside the extension point XConDeclField.

Instances2Data, Outputable
datadata HsImplBang
#

Haskell Implementation Bang

Bangs of data constructor arguments as generated by the compiler after consulting HsSrcBang, flags, etc.

Constructors

  • HsLazy

    Lazy field, or one with an unlifted type

  • HsStrict Bool

    Strict but not unpacked field True = we could have unpacked, but opted not to because of -O0. See Note [Detecting useless UNPACK pragmas]

  • HsUnpack (Maybe Coercion)

    Strict and unpacked field co :: arg-ty ~ product-ty HsBang

Instances2Data, Outputable
datadata SrcStrictness
#

Source Strictness

What strictness annotation the user wrote

Constructors

Instances5Eq, Data, NFData, Outputable, Binary
datadata SrcUnpackedness
#

Source Unpackedness

What unpackedness the user requested

Constructors

Instances5Eq, Data, NFData, Outputable, Binary
datadata HsConDeclRecField pass
#

Constructor Declaration Record Field

Instances9Data, Outputable, ToHie, HasHaddock, Anno, …
datadata HsConDetails arg rec
#

Describes the arguments to a data constructor. This is a common representation for several constructor-related concepts, including:

  • The arguments in a Haskell98-style constructor declaration (see HsConDeclH98Details in GHC.Hs.Decls).

  • The arguments in constructor patterns in case/function definitions (see HsConPatDetails in GHC.Hs.Pat).

  • The left-hand side arguments in a pattern synonym binding (see HsPatSynDetails in GHC.Hs.Binds).

One notable exception is the arguments in a GADT constructor, which uses a separate data type entirely (see HsConDeclGADTDetails in GHC.Hs.Decls). This is because GADT constructors cannot be declared with infix syntax, unlike the concepts above (#18844).

Constructors

Instances3Data, Outputable, ToHie
datadata HsConDeclField pass
#

Constructor declaration field specification, see Note [HsConDeclField on pass]

Constructors

Instances5Data, ToHie, HasHaddock
datadata FieldOcc pass
#

Field Occurrence

Represents an *occurrence* of a field. This may or may not be a binding occurrence (e.g. this type is used in HsConDeclRecField and RecordPatSynField which bind their fields, but also in HsRecField for record construction and patterns, which do not).

We store both the RdrName the user originally wrote, and after the renamer we use the extension field to store the selector function. See note [FieldOcc pass]

There is a wrinkle in that update field occurances are sometimes ambiguous during the rename stage. See note [Ambiguous FieldOcc in record updates] to see how we currently handle this.

Constructors

Instances10Eq, Data, Outputable, ToHie, OutputableBndr, Anno, …

Decompose a type class instance type (of the form forall tvs. context => instance_head) into its constituent parts. Note that the [Name]s returned correspond to either:

  • The implicitly bound type variables (if the type lacks an outermost forall), or

  • The explicitly bound type variables (if the type has an outermost forall).

This function is careful not to look through parentheses. See Note [No nested foralls or contexts in instance types] for why this is important.

Decompose a pattern synonym type signature into its constituent parts.

Note that this function looks through parentheses, so it will work on types such as (forall a. ...). The downside to this is that it is not generally possible to take the returned types and reconstruct the original type (parentheses and all) from them.

Decompose a type of the form forall tvs. body into its constituent parts. Only splits type variable binders that were quantified invisibly (e.g., forall a., with a dot).

This function is used to split apart certain types, such as instance declaration types, which disallow visible foralls. For instance, if GHC split apart the forall in instance forall a -> Show (Blah a), then that declaration would mistakenly be accepted!

Note that this function looks through parentheses, so it will work on types such as (forall a. ...). The downside to this is that it is not generally possible to take the returned types and reconstruct the original type (parentheses and all) from them. Unlike splitLHsSigmaTyInvis, this function does not look through parentheses, hence the suffix _KP (short for "Keep Parentheses").

Decompose a type of the form forall tvs. body into its constituent parts. Only splits type variable binders that were quantified invisibly (e.g., forall a., with a dot).

This function is used to split apart certain types, such as instance declaration types, which disallow visible foralls. For instance, if GHC split apart the forall in instance forall a -> Show (Blah a), then that declaration would mistakenly be accepted!

Unlike splitLHsForAllTyInvis, this function does not look through parentheses, hence the suffix _KP (short for "Keep Parentheses").

valuesplitLHsQualTy
  1. :: LHsType (GhcPass pass)
  2. -> (Maybe (LHsContext (GhcPass pass)), LHsType (GhcPass pass))
#

Decompose a type of the form context => body into its constituent parts.

Note that this function looks through parentheses, so it will work on types such as (context => ...). The downside to this is that it is not generally possible to take the returned types and reconstruct the original type (parentheses and all) from them.

Decompose a sigma type (of the form forall tvs. context => body) into its constituent parts. Only splits type variable binders that were quantified invisibly (e.g., forall a., with a dot).

This function is used to split apart certain types, such as instance declaration types, which disallow visible foralls. For instance, if GHC split apart the forall in instance forall a -> Show (Blah a), then that declaration would mistakenly be accepted!

Note that this function looks through parentheses, so it will work on types such as (forall a. ...). The downside to this is that it is not generally possible to take the returned types and reconstruct the original type (parentheses and all) from them.

Decompose a GADT type into its constituent parts. Returns (outer_bndrs, mb_ctxt, body), where:

  • outer_bndrs are HsOuterExplicit if the type has explicit, outermost type variable binders. Otherwise, they are HsOuterImplicit.

  • mb_ctxt is Just the context, if it is provided. Otherwise, it is Nothing.

  • body is the body of the type after the optional foralls and context.

This function is careful not to look through parentheses. See Note [GADT abstract syntax] (Wrinkle: No nested foralls or contexts) GHC.Hs.Decls for why this is important.

valuehsTyKindSig :: LHsType (GhcPass p) -> Maybe (LHsKind (GhcPass p))
#

Get the kind signature of a type, ignoring parentheses:

hsTyKindSig `Maybe ` = Nothing hsTyKindSig `Maybe :: Type -> Type ` = Just `Type -> Type` hsTyKindSig `Maybe :: ((Type -> Type))` = Just `Type -> Type`

This is used to extract the result kind of type synonyms with a CUSK:

type S = (F :: res_kind) ^^^^^^^^

Orphan instances

18 instances