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.Types.Basic

  • 51 types
  • 116 values
  • Packageghc-9.10.3
  • Exports167
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceBasic.hs
typetype ConTag = Int
#

A *one-index* constructor tag

Type of the tags associated with each constructor possibility or superclass selector

typetype ConTagZ = Int
#

A *zero-indexed* constructor tag

valuefIRST_TAG :: ConTag
#

Tags are allocated from here for real constructors or for superclass selectors

typetype Arity = Int
#

The number of value arguments that can be applied to a value before it does "real work". So: fib 100 has arity 0 x -> fib x has arity 1 See also Note [Definition of arity] in GHC.Core.Opt.Arity

typetype VisArity = Int
#

Syntactic (visibility) arity, i.e. the number of visible arguments. See Note [Visibility and arity]

typetype RepArity = Int
#

Representation Arity

The number of represented arguments that can be applied to a value before it does "real work". So: fib 100 has representation arity 0 x -> fib x has representation arity 1 (# x, y #) -> fib (x + y) has representation arity 2

typetype JoinArity = Int
#

The number of arguments that a join point takes. Unlike the arity of a function, this is a purely syntactic property and is fixed when the join point is created (or converted from a value). Both type and value arguments are counted.

typetype FullArgCount = Int
#

FullArgCount is the number of type or value arguments in an application, or the number of type or value binders in a lambda. Note: it includes both type and value arguments!

datadata Origin
#

Was this piece of code user-written or generated by the compiler?

See Note [Generated code and pattern-match checking].

Instances3Eq, Data, Outputable
datadata DoPmc
#

Whether to run pattern-match checks in generated code.

See Note [Generated code and pattern-match checking].

Instances3Eq, Data, Outputable
valuerequiresPMC :: Origin -> Bool
#

Does this Origin require us to run pattern-match checking, or should we skip these checks?

See Note [Generated code and pattern-match checking].

datadata GenReason
#

This metadata stores the information as to why was the piece of code generated It is useful for generating the right error context See Part 3 in Note [Expanding HsDo with XXExprGhcRn] in GHC.Tc.Gen.Do

Instances3Eq, Data, Outputable
datadata OverlapFlag
#

The semantics allowed for overlapping instances for a particular instance. See Note [Safe Haskell isSafeOverlap] in GHC.Core.InstEnv for a explanation of the isSafeOverlap field.

Instances4Eq, Data, Outputable, Binary
datadata OverlapMode
#

Constructors

  • NoOverlap SourceText

    This instance must not overlap another NoOverlap instance. However, it may be overlapped by Overlapping instances, and it may overlap Overlappable instances.

  • Overlappable SourceText

    Silently ignore this instance if you find a more specific one that matches the constraint you are trying to resolve

    Example: constraint (Foo [Int]) instance Foo [Int] instance {-# OVERLAPPABLE #-} Foo [a]

    Since the second instance has the Overlappable flag, the first instance will be chosen (otherwise its ambiguous which to choose)

  • Overlapping SourceText

    Silently ignore any more general instances that may be used to solve the constraint.

    Example: constraint (Foo [Int]) instance {-# OVERLAPPING #-} Foo [Int] instance Foo [a]

    Since the first instance has the Overlapping flag, the second---more general---instance will be ignored (otherwise it is ambiguous which to choose)

  • Overlaps SourceText

    Equivalent to having both Overlapping and Overlappable flags.

  • Incoherent SourceText

    Behave like Overlappable and Overlapping, and in addition pick an arbitrary one if there are multiple matching candidates, and don't worry about later instantiation

    Example: constraint (Foo [b]) instance {-# INCOHERENT -} Foo [Int] instance Foo [a] Without the Incoherent flag, we'd complain that instantiating b would change which instance was chosen. See also Note [Incoherent instances] in GHC.Core.InstEnv

  • NonCanonical SourceText

    Behave like Incoherent, but the instance choice is observable by the program behaviour. See Note [Coherence and specialisation: overview].

    We don't have surface syntax for the distinction between Incoherent and NonCanonical instances; instead, the flag `-f{no-}specialise-incoherents` (on by default) controls whether INCOHERENT instances are regarded as Incoherent or NonCanonical.

Instances7Eq, Data, Outputable, Binary, ToHie, Anno, …
datadata Boxity
#
Instances4Eq, Data, Outputable, Binary
  • Eq BoxityDefined in ghc-9.10.3 · Language.Haskell.Syntax.Basic
  • Data BoxityDefined in ghc-9.10.3 · Language.Haskell.Syntax.Basic
  • Outputable BoxityDefined in ghc-9.10.3 · GHC.Types.Basic · orphan
  • Binary BoxityDefined in ghc-9.10.3 · GHC.Types.Basic · orphan
newtypenewtype PprPrec
#

A general-purpose pretty-printing precedence type.

Constructors

Instances3Eq, Ord, Show
  • Eq PprPrecDefined in ghc-9.10.3 · GHC.Types.Basic
  • Ord PprPrecDefined in ghc-9.10.3 · GHC.Types.Basic
  • Show PprPrecDefined in ghc-9.10.3 · GHC.Types.Basic
valuepprAlternative
  1. :: (a -> SDoc)

    The pretty printing function to use

  2. -> a

    The things to be pretty printed

  3. -> ConTag

    Alternative (one-based)

  4. -> Arity

    Arity

  5. -> SDoc

    SDoc where the alternative havs been pretty printed and finally packed into a paragraph.

#

Pretty print an alternative in an unboxed sum e.g. "| a | |".

The OneShotInfo type

103 declarations
datadata OneShotInfo
#

If the Id is a lambda-bound variable then it may have lambda-bound variable info. Sometimes we know whether the lambda binding this variable is a "one-shot" lambda; that is, whether it is applied at most once.

This information may be useful in optimisation, as computations may safely be floated inside such a lambda without risk of duplicating work.

See also Note [OneShotInfo overview] above.

Constructors

Instances2Eq, Outputable
datadata OccInfo
#

identifier Occurrence Information

Constructors

Instances2Eq, Outputable
datadata InsideLam
#

Inside Lambda

Constructors

  • IsInsideLam

    Occurs inside a non-linear lambda Substituting a redex for this occurrence is dangerous because it might duplicate work.

  • NotInsideLam
Instances3Eq, Semigroup, Monoid
  • Eq InsideLamDefined in ghc-9.10.3 · GHC.Types.Basic
  • Semigroup InsideLamDefined in ghc-9.10.3 · GHC.Types.Basic

    If any occurrence of an identifier is inside a lambda, then the occurrence info of that identifier marks it as occurring inside a lambda

  • Monoid InsideLamDefined in ghc-9.10.3 · GHC.Types.Basic
datadata InterestingCxt
#

Interesting Context

Constructors

Instances3Eq, Semigroup, Monoid
  • Eq InterestingCxtDefined in ghc-9.10.3 · GHC.Types.Basic
  • Semigroup InterestingCxtDefined in ghc-9.10.3 · GHC.Types.Basic

    If there is any interesting identifier occurrence, then the aggregated occurrence info of that identifier is considered interesting.

  • Monoid InterestingCxtDefined in ghc-9.10.3 · GHC.Types.Basic
datadata EP a
#

Embedding Projection pair

Constructors

Outputs string for pragma name for any of INLINEINLINABLENOINLINE. This differs from the Outputable instance for the InlineSpec type where the pragma name string as well as the accompanying SourceText (if any) is printed.

datadata TyConFlavour tc
#

Paints a picture of what a TyCon represents, in broad strokes. This is used towards more informative error messages.

Instances5Functor, Eq, Data, NFData, Outputable

Specify whether to default type variables of kind RuntimeRepLevityMultiplicity.

Constructors

  • DefaultNonStandardTyVars

    Default type variables of the given kinds:

    • default RuntimeRep variables to LiftedRep

    • default Levity variables to Lifted

    • default Multiplicity variables to Many

  • TryNotToDefaultNonStandardTyVars

    Try not to default type variables of the kinds RuntimeRepLevityMultiplicity.

    Note that these might get defaulted anyway, if they are kind variables and `-XNoPolyKinds` is enabled.

Instances1Outputable
datadata DefaultingStrategy
#

Specify whether to default kind variables, and type variables of kind RuntimeRepLevityMultiplicity.

Constructors

  • DefaultKindVars

    Default kind variables:

    • default kind variables of kind Type to Type,

    • default RuntimeRepLevityMultiplicity kind variables to LiftedRepLiftedMany, respectively.

    When this strategy is used, it means that we have determined that the variables we are considering defaulting are all kind variables.

    Usually, we pass this option when -XNoPolyKinds is enabled.

  • NonStandardDefaulting NonStandardDefaultingStrategy

    Default (or don't default) non-standard variables, of kinds RuntimeRep, Levity and Multiplicity.

Instances1Outputable
datadata ForeignSrcLang
#

Foreign formats supported by GHC via TH

Constructors

Instances5Eq, Show, Generic, Binary, Rep

Orphan instances

4 instances