GHC.Builtin.Types

ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Builtin.Types

Contents

- Helper functions defined here
- All wired in things
- Bool
- Ordering
- Boxing primitive types
- Char
- Double
- Float
- Int
- Word
- Word8
- List
- Maybe
- Tuples
  - Constraint tuples
- Any
- Recovery TyCon
- Sums
- Kinds
- Equality predicates
- RuntimeRep and friends
- Levity
- Multiplicity and friends
- Bignum

Description

This module is about types that can be defined in Haskell, but which must be wired into the compiler nonetheless. C.f module GHC.Builtin.Types.Prim

Synopsis

- mkWiredInTyConName :: BuiltInSyntax -> Module -> FastString -> Unique -> TyCon -> Name
- mkWiredInIdName :: Module -> FastString -> Unique -> Id -> Name
- wiredInTyCons :: [TyCon]
- isBuiltInOcc :: OccName -> Bool
- isBuiltInOcc_maybe :: Bool -> OccName -> Maybe Name
- isTupleTyOrigName_maybe :: Module -> OccName -> Maybe Name
- isSumTyOrigName_maybe :: Module -> OccName -> Maybe Name
- isInfiniteFamilyOrigName_maybe :: Module -> OccName -> Maybe Name
- boolTy :: Type
- boolTyCon :: TyCon
- boolTyCon_RDR :: RdrName
- boolTyConName :: Name
- trueDataCon :: DataCon
- trueDataConId :: Id
- true_RDR :: RdrName
- falseDataCon :: DataCon
- falseDataConId :: Id
- false_RDR :: RdrName
- promotedFalseDataCon :: TyCon
- promotedTrueDataCon :: TyCon
- orderingTyCon :: TyCon
- ordLTDataCon :: DataCon
- ordLTDataConId :: Id
- ordEQDataCon :: DataCon
- ordEQDataConId :: Id
- ordGTDataCon :: DataCon
- ordGTDataConId :: Id
- promotedLTDataCon :: TyCon
- promotedEQDataCon :: TyCon
- promotedGTDataCon :: TyCon
- boxingDataCon :: Type -> BoxingInfo b
- data BoxingInfo b
  - = BI_NoBoxNeeded
  - | BI_NoBoxAvailable
  - | BI_Box {
    - bi_data_con :: DataCon
    - bi_inst_con :: Expr b
    - bi_boxed_type :: Type
    }
- charTyCon :: TyCon
- charDataCon :: DataCon
- charTyCon_RDR :: RdrName
- charTy :: Type
- stringTy :: Type
- charTyConName :: Name
- stringTyCon_RDR :: RdrName
- doubleTyCon :: TyCon
- doubleDataCon :: DataCon
- doubleTy :: Type
- doubleTyConName :: Name
- floatTyCon :: TyCon
- floatDataCon :: DataCon
- floatTy :: Type
- floatTyConName :: Name
- intTyCon :: TyCon
- intDataCon :: DataCon
- intTyCon_RDR :: RdrName
- intDataCon_RDR :: RdrName
- intTyConName :: Name
- intTy :: Type
- wordTyCon :: TyCon
- wordDataCon :: DataCon
- wordTyConName :: Name
- wordTy :: Type
- word8TyCon :: TyCon
- word8DataCon :: DataCon
- word8Ty :: Type
- listTyCon :: TyCon
- listTyCon_RDR :: RdrName
- listTyConName :: Name
- listTyConKey :: Unique
- nilDataCon :: DataCon
- nilDataConName :: Name
- nilDataConKey :: Unique
- consDataCon_RDR :: RdrName
- consDataCon :: DataCon
- consDataConName :: Name
- promotedNilDataCon :: TyCon
- promotedConsDataCon :: TyCon
- mkListTy :: Type -> Type
- mkPromotedListTy :: Kind -> [Type] -> Type
- extractPromotedList :: Type -> [Type]
- maybeTyCon :: TyCon
- maybeTyConName :: Name
- nothingDataCon :: DataCon
- nothingDataConName :: Name
- promotedNothingDataCon :: TyCon
- justDataCon :: DataCon
- justDataConName :: Name
- promotedJustDataCon :: TyCon
- mkPromotedMaybeTy :: Kind -> Maybe Type -> Type
- mkMaybeTy :: Type -> Kind
- isPromotedMaybeTy :: Type -> Maybe (Maybe Type)
- mkTupleTy :: Boxity -> [Type] -> Type
- mkTupleTy1 :: Boxity -> [Type] -> Type
- mkBoxedTupleTy :: [Type] -> Type
- mkTupleStr :: Boxity -> NameSpace -> Arity -> String
- tupleTyCon :: Boxity -> Arity -> TyCon
- tupleDataCon :: Boxity -> Arity -> DataCon
- tupleTyConName :: TupleSort -> Arity -> Name
- tupleDataConName :: Boxity -> Arity -> Name
- promotedTupleDataCon :: Boxity -> Arity -> TyCon
- unitTyCon :: TyCon
- unitDataCon :: DataCon
- unitDataConId :: Id
- unitTy :: Type
- unitTyConKey :: Unique
- soloTyCon :: TyCon
- soloDataConName :: Name
- pairTyCon :: TyCon
- mkPromotedPairTy :: Kind -> Kind -> Type -> Type -> Type
- isPromotedPairType :: Type -> Maybe (Type, Type)
- unboxedUnitTy :: Type
- unboxedUnitTyCon :: TyCon
- unboxedUnitDataCon :: DataCon
- unboxedSoloTyCon :: TyCon
- unboxedSoloTyConName :: Name
- unboxedSoloDataConName :: Name
- unboxedTupleKind :: [Type] -> Kind
- unboxedSumKind :: [Type] -> Kind
- mkConstraintTupleTy :: [Type] -> Type
- cTupleTyCon :: Arity -> TyCon
- cTupleTyConName :: Arity -> Name
- cTupleTyConNames :: [Name]
- isCTupleTyConName :: Name -> Bool
- cTupleDataCon :: Arity -> DataCon
- cTupleDataConName :: Arity -> Name
- cTupleDataConNames :: [Name]
- cTupleSelId :: ConTag -> Arity -> Id
- cTupleSelIdName :: ConTag -> Arity -> Name
- anyTyCon :: TyCon
- anyTy :: Type
- anyTypeOfKind :: Kind -> Type
- zonkAnyTyCon :: TyCon
- makeRecoveryTyCon :: TyCon -> TyCon
- mkSumTy :: [Type] -> Type
- sumTyCon :: Arity -> TyCon
- sumDataCon :: ConTag -> Arity -> DataCon
- unboxedSumTyConName :: Arity -> Name
- unboxedSumDataConName :: ConTag -> Arity -> Name
- typeSymbolKindCon :: TyCon
- typeSymbolKind :: Kind
- isLiftedTypeKindTyConName :: Name -> Bool
- typeToTypeKind :: Type
- liftedRepTyCon :: TyCon
- unliftedRepTyCon :: TyCon
- tYPETyCon :: TyCon
- tYPETyConName :: Name
- tYPEKind :: Type
- cONSTRAINTTyCon :: TyCon
- cONSTRAINTTyConName :: Name
- cONSTRAINTKind :: Type
- constraintKind :: Kind
- liftedTypeKind :: Type
- unliftedTypeKind :: Type
- zeroBitTypeKind :: Type
- constraintKindTyCon :: TyCon
- liftedTypeKindTyCon :: TyCon
- unliftedTypeKindTyCon :: TyCon
- constraintKindTyConName :: Name
- liftedTypeKindTyConName :: Name
- unliftedTypeKindTyConName :: Name
- liftedRepTyConName :: Name
- unliftedRepTyConName :: Name
- heqTyCon :: TyCon
- heqTyConName :: Name
- heqClass :: Class
- heqDataCon :: DataCon
- eqTyCon :: TyCon
- eqTyConName :: Name
- eqClass :: Class
- eqDataCon :: DataCon
- eqTyCon_RDR :: RdrName
- coercibleTyCon :: TyCon
- coercibleTyConName :: Name
- coercibleDataCon :: DataCon
- coercibleClass :: Class
- runtimeRepTyCon :: TyCon
- vecCountTyCon :: TyCon
- vecElemTyCon :: TyCon
- boxedRepDataConTyCon :: TyCon
- runtimeRepTy :: Type
- liftedRepTy :: RuntimeRepType
- unliftedRepTy :: RuntimeRepType
- zeroBitRepTy :: RuntimeRepType
- vecRepDataConTyCon :: TyCon
- tupleRepDataConTyCon :: TyCon
- sumRepDataConTyCon :: TyCon
- levityTyCon :: TyCon
- levityTy :: Type
- liftedDataConTyCon :: TyCon
- unliftedDataConTyCon :: TyCon
- liftedDataConTy :: Type
- unliftedDataConTy :: Type
- intRepDataConTy :: RuntimeRepType
- int8RepDataConTy :: RuntimeRepType
- int16RepDataConTy :: RuntimeRepType
- int32RepDataConTy :: RuntimeRepType
- int64RepDataConTy :: RuntimeRepType
- wordRepDataConTy :: RuntimeRepType
- word8RepDataConTy :: RuntimeRepType
- word16RepDataConTy :: RuntimeRepType
- word32RepDataConTy :: RuntimeRepType
- word64RepDataConTy :: RuntimeRepType
- addrRepDataConTy :: RuntimeRepType
- floatRepDataConTy :: RuntimeRepType
- doubleRepDataConTy :: RuntimeRepType
- vec2DataConTy :: Type
- vec4DataConTy :: Type
- vec8DataConTy :: Type
- vec16DataConTy :: Type
- vec32DataConTy :: Type
- vec64DataConTy :: Type
- int8ElemRepDataConTy :: Type
- int16ElemRepDataConTy :: Type
- int32ElemRepDataConTy :: Type
- int64ElemRepDataConTy :: Type
- word8ElemRepDataConTy :: Type
- word16ElemRepDataConTy :: Type
- word32ElemRepDataConTy :: Type
- word64ElemRepDataConTy :: Type
- floatElemRepDataConTy :: Type
- doubleElemRepDataConTy :: Type
- multiplicityTyConName :: Name
- oneDataConName :: Name
- manyDataConName :: Name
- multiplicityTy :: Type
- multiplicityTyCon :: TyCon
- oneDataCon :: DataCon
- manyDataCon :: DataCon
- oneDataConTy :: Type
- manyDataConTy :: Type
- oneDataConTyCon :: TyCon
- manyDataConTyCon :: TyCon
- multMulTyCon :: TyCon
- unrestrictedFunTyCon :: TyCon
- unrestrictedFunTyConName :: Name
- integerTy :: Type
- integerTyCon :: TyCon
- integerTyConName :: Name
- integerISDataCon :: DataCon
- integerISDataConName :: Name
- integerIPDataCon :: DataCon
- integerIPDataConName :: Name
- integerINDataCon :: DataCon
- integerINDataConName :: Name
- naturalTy :: Type
- naturalTyCon :: TyCon
- naturalTyConName :: Name
- naturalNSDataCon :: DataCon
- naturalNSDataConName :: Name
- naturalNBDataCon :: DataCon
- naturalNBDataConName :: Name
- pretendNameIsInScope :: Name -> Bool

# Helper functions defined here

mkWiredInTyConName :: BuiltInSyntax -> Module -> FastString -> Unique -> TyCon -> Name #

mkWiredInIdName :: Module -> FastString -> Unique -> Id -> Name #

# All wired in things

wiredInTyCons :: [TyCon] #

isBuiltInOcc :: OccName -> Bool #

Check if the OccName is an occurrence of built-in syntax.

This is a variant of `isBuiltInOcc_maybe` that returns a `Bool`. See Note [isBuiltInOcc_maybe]

`isBuiltInOcc` holds for: * function arrow `->` * list syntax `[]`, `:` * boxed tuple syntax `()`, `(,)`, `(,,)`, `(,,,)`, ... * unboxed tuple syntax `(##)`, `()`, `()`, ... * unboxed sum type syntax `(#|#)`, `(#||#)`, `(#|||#)`, ... * unboxed sum data syntax `()`, `()`, `(), ...

isBuiltInOcc_maybe :: Bool -> OccName -> Maybe Name #

Match on built-in syntax as it occurs at use sites. See Note [isBuiltInOcc_maybe]

isTupleTyOrigName_maybe :: Module -> OccName -> Maybe Name #

isSumTyOrigName_maybe :: Module -> OccName -> Maybe Name #

isInfiniteFamilyOrigName_maybe :: Module -> OccName -> Maybe Name #

# Bool

boolTy :: Type #

boolTyCon :: TyCon #

boolTyCon_RDR :: RdrName #

boolTyConName :: Name #

trueDataCon :: DataCon #

trueDataConId :: Id #

true_RDR :: RdrName #

falseDataCon :: DataCon #

falseDataConId :: Id #

false_RDR :: RdrName #

promotedFalseDataCon :: TyCon #

promotedTrueDataCon :: TyCon #

# Ordering

orderingTyCon :: TyCon #

ordLTDataCon :: DataCon #

ordLTDataConId :: Id #

ordEQDataCon :: DataCon #

ordEQDataConId :: Id #

ordGTDataCon :: DataCon #

ordGTDataConId :: Id #

promotedLTDataCon :: TyCon #

promotedEQDataCon :: TyCon #

promotedGTDataCon :: TyCon #

# Boxing primitive types

boxingDataCon :: Type -> BoxingInfo b #

Given a type `ty`, if `ty` is not of kind Type, return a data constructor that will box it, and the type of the boxed thing, which does now have kind Type. See Note [Boxing constructors]

data BoxingInfo b #

Constructors

BI_NoBoxNeeded |
BI_NoBoxAvailable |
BI_Box |
Fields bi_data_con :: DataCon bi_inst_con :: Expr b bi_boxed_type :: Type

# Char

charTyCon :: TyCon #

charDataCon :: DataCon #

charTyCon_RDR :: RdrName #

charTy :: Type #

stringTy :: Type #

charTyConName :: Name #

stringTyCon_RDR :: RdrName #

# Double

doubleTyCon :: TyCon #

doubleDataCon :: DataCon #

doubleTy :: Type #

doubleTyConName :: Name #

# Float

floatTyCon :: TyCon #

floatDataCon :: DataCon #

floatTy :: Type #

floatTyConName :: Name #

# Int

intTyCon :: TyCon #

intDataCon :: DataCon #

intTyCon_RDR :: RdrName #

intDataCon_RDR :: RdrName #

intTyConName :: Name #

intTy :: Type #

# Word

wordTyCon :: TyCon #

wordDataCon :: DataCon #

wordTyConName :: Name #

wordTy :: Type #

# Word8

word8TyCon :: TyCon #

word8DataCon :: DataCon #

word8Ty :: Type #

# List

listTyCon :: TyCon #

listTyCon_RDR :: RdrName #

listTyConName :: Name #

listTyConKey :: Unique #

nilDataCon :: DataCon #

nilDataConName :: Name #

nilDataConKey :: Unique #

consDataCon_RDR :: RdrName #

consDataCon :: DataCon #

consDataConName :: Name #

promotedNilDataCon :: TyCon #

promotedConsDataCon :: TyCon #

mkListTy :: Type -> Type #

mkPromotedListTy #

Arguments

:: Kind | of the elements of the list
-> [Type] | elements
-> Type |

Make a *promoted* list.

extractPromotedList #

Arguments

:: Type | The promoted list
-> [Type] |

Extract the elements of a promoted list. Panics if the type is not a promoted list

# Maybe

maybeTyCon :: TyCon #

maybeTyConName :: Name #

nothingDataCon :: DataCon #

nothingDataConName :: Name #

promotedNothingDataCon :: TyCon #

justDataCon :: DataCon #

justDataConName :: Name #

promotedJustDataCon :: TyCon #

mkPromotedMaybeTy :: Kind -> Maybe Type -> Type #

mkMaybeTy :: Type -> Kind #

isPromotedMaybeTy :: Type -> Maybe (Maybe Type) #

# Tuples

mkTupleTy :: Boxity -> [Type] -> Type #

Make a tuple type. The list of types should not include any RuntimeRep specifications. Boxed 1-tuples are flattened. See Note [One-tuples]

mkTupleTy1 :: Boxity -> [Type] -> Type #

Make a tuple type. The list of types should not include any RuntimeRep specifications. Boxed 1-tuples are *not* flattened. See Note [One-tuples] and Note [Don't flatten tuples from HsSyn] in GHC.Core.Make

mkBoxedTupleTy :: [Type] -> Type #

Build the type of a small tuple that holds the specified type of thing Flattens 1-tuples. See Note [One-tuples].

mkTupleStr :: Boxity -> NameSpace -> Arity -> String #

tupleTyCon :: Boxity -> Arity -> TyCon #

tupleDataCon :: Boxity -> Arity -> DataCon #

tupleTyConName :: TupleSort -> Arity -> Name #

tupleDataConName :: Boxity -> Arity -> Name #

promotedTupleDataCon :: Boxity -> Arity -> TyCon #

unitTyCon :: TyCon #

unitDataCon :: DataCon #

unitDataConId :: Id #

unitTy :: Type #

unitTyConKey :: Unique #

soloTyCon :: TyCon #

soloDataConName :: Name #

pairTyCon :: TyCon #

mkPromotedPairTy :: Kind -> Kind -> Type -> Type -> Type #

isPromotedPairType :: Type -> Maybe (Type, Type) #

unboxedUnitTy :: Type #

unboxedUnitTyCon :: TyCon #

unboxedUnitDataCon :: DataCon #

unboxedSoloTyCon :: TyCon #

unboxedSoloTyConName :: Name #

unboxedSoloDataConName :: Name #

unboxedTupleKind :: [Type] -> Kind #

Specialization of `unboxedTupleSumKind` for tuples

unboxedSumKind :: [Type] -> Kind #

Specialization of `unboxedTupleSumKind` for sums

mkConstraintTupleTy :: [Type] -> Type #

## Constraint tuples

cTupleTyCon :: Arity -> TyCon #

cTupleTyConName :: Arity -> Name #

cTupleTyConNames :: [Name] #

isCTupleTyConName :: Name -> Bool #

cTupleDataCon :: Arity -> DataCon #

cTupleDataConName :: Arity -> Name #

cTupleDataConNames :: [Name] #

cTupleSelId :: ConTag -> Arity -> Id #

cTupleSelIdName :: ConTag -> Arity -> Name #

# Any

anyTyCon :: TyCon #

anyTy :: Type #

anyTypeOfKind :: Kind -> Type #

zonkAnyTyCon :: TyCon #

# Recovery TyCon

makeRecoveryTyCon :: TyCon -> TyCon #

Make a fake, recovery `TyCon` from an existing one. Used when recovering from errors in type declarations

# Sums

mkSumTy :: [Type] -> Type #

sumTyCon :: Arity -> TyCon #

Type constructor for n-ary unboxed sum.

sumDataCon :: ConTag -> Arity -> DataCon #

Data constructor for i-th alternative of a n-ary unboxed sum.

unboxedSumTyConName :: Arity -> Name #

unboxedSumDataConName :: ConTag -> Arity -> Name #

# Kinds

typeSymbolKindCon :: TyCon #

typeSymbolKind :: Kind #

isLiftedTypeKindTyConName :: Name -> Bool #

typeToTypeKind :: Type #

liftedRepTyCon :: TyCon #

    type LiftedRep = 'BoxedRep 'Lifted

unliftedRepTyCon :: TyCon #

    type UnliftedRep = 'BoxedRep 'Unlifted

tYPETyCon :: TyCon #

tYPETyConName :: Name #

tYPEKind :: Type #

cONSTRAINTTyCon :: TyCon #

cONSTRAINTTyConName :: Name #

cONSTRAINTKind :: Type #

constraintKind :: Kind #

liftedTypeKind :: Type #

unliftedTypeKind :: Type #

zeroBitTypeKind :: Type #

constraintKindTyCon :: TyCon #

liftedTypeKindTyCon :: TyCon #

unliftedTypeKindTyCon :: TyCon #

constraintKindTyConName :: Name #

liftedTypeKindTyConName :: Name #

unliftedTypeKindTyConName :: Name #

liftedRepTyConName :: Name #

unliftedRepTyConName :: Name #

# Equality predicates

heqTyCon :: TyCon #

heqTyConName :: Name #

heqClass :: Class #

heqDataCon :: DataCon #

eqTyCon :: TyCon #

eqTyConName :: Name #

eqClass :: Class #

eqDataCon :: DataCon #

eqTyCon_RDR :: RdrName #

coercibleTyCon :: TyCon #

coercibleTyConName :: Name #

coercibleDataCon :: DataCon #

coercibleClass :: Class #

# RuntimeRep and friends

runtimeRepTyCon :: TyCon #

vecCountTyCon :: TyCon #

vecElemTyCon :: TyCon #

boxedRepDataConTyCon :: TyCon #

runtimeRepTy :: Type #

liftedRepTy :: RuntimeRepType #

unliftedRepTy :: RuntimeRepType #

zeroBitRepTy :: RuntimeRepType #

vecRepDataConTyCon :: TyCon #

tupleRepDataConTyCon :: TyCon #

sumRepDataConTyCon :: TyCon #

# Levity

levityTyCon :: TyCon #

levityTy :: Type #

liftedDataConTyCon :: TyCon #

unliftedDataConTyCon :: TyCon #

liftedDataConTy :: Type #

unliftedDataConTy :: Type #

intRepDataConTy :: RuntimeRepType #

int8RepDataConTy :: RuntimeRepType #

int16RepDataConTy :: RuntimeRepType #

int32RepDataConTy :: RuntimeRepType #

int64RepDataConTy :: RuntimeRepType #

wordRepDataConTy :: RuntimeRepType #

word8RepDataConTy :: RuntimeRepType #

word16RepDataConTy :: RuntimeRepType #

word32RepDataConTy :: RuntimeRepType #

word64RepDataConTy :: RuntimeRepType #

addrRepDataConTy :: RuntimeRepType #

floatRepDataConTy :: RuntimeRepType #

doubleRepDataConTy :: RuntimeRepType #

vec2DataConTy :: Type #

vec4DataConTy :: Type #

vec8DataConTy :: Type #

vec16DataConTy :: Type #

vec32DataConTy :: Type #

vec64DataConTy :: Type #

int8ElemRepDataConTy :: Type #

int16ElemRepDataConTy :: Type #

int32ElemRepDataConTy :: Type #

int64ElemRepDataConTy :: Type #

word8ElemRepDataConTy :: Type #

word16ElemRepDataConTy :: Type #

word32ElemRepDataConTy :: Type #

word64ElemRepDataConTy :: Type #

floatElemRepDataConTy :: Type #

doubleElemRepDataConTy :: Type #

# Multiplicity and friends

multiplicityTyConName :: Name #

oneDataConName :: Name #

manyDataConName :: Name #

multiplicityTy :: Type #

multiplicityTyCon :: TyCon #

oneDataCon :: DataCon #

manyDataCon :: DataCon #

oneDataConTy :: Type #

manyDataConTy :: Type #

oneDataConTyCon :: TyCon #

manyDataConTyCon :: TyCon #

multMulTyCon :: TyCon #

unrestrictedFunTyCon :: TyCon #

unrestrictedFunTyConName :: Name #

# Bignum

integerTy :: Type #

integerTyCon :: TyCon #

integerTyConName :: Name #

integerISDataCon :: DataCon #

integerISDataConName :: Name #

integerIPDataCon :: DataCon #

integerIPDataConName :: Name #

integerINDataCon :: DataCon #

integerINDataConName :: Name #

naturalTy :: Type #

naturalTyCon :: TyCon #

naturalTyConName :: Name #

naturalNSDataCon :: DataCon #

naturalNSDataConName :: Name #

naturalNBDataCon :: DataCon #

naturalNBDataConName :: Name #

pretendNameIsInScope :: Name -> Bool #

Should this name be considered in-scope, even though it technically isn't?

This ensures that we don't filter out information because, e.g., Data.Kind.Type isn't imported.

See Note [pretendNameIsInScope].