ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

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_maybe :: OccName -> Maybe Name
- isPunOcc_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
- 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
- pairTyCon :: TyCon
- mkPromotedPairTy :: Kind -> Kind -> Type -> Type -> Type
- isPromotedPairType :: Type -> Maybe (Type, Type)
- unboxedUnitTy :: Type
- unboxedUnitTyCon :: TyCon
- unboxedUnitDataCon :: DataCon
- unboxedTupleKind :: [Type] -> Kind
- unboxedSumKind :: [Type] -> Kind
- filterCTuple :: RdrName -> RdrName
- mkConstraintTupleTy :: [Type] -> Type
- cTupleTyCon :: Arity -> TyCon
- cTupleTyConName :: Arity -> Name
- cTupleTyConNames :: [Name]
- isCTupleTyConName :: Name -> Bool
- cTupleTyConNameArity_maybe :: Name -> Maybe Arity
- cTupleDataCon :: Arity -> DataCon
- cTupleDataConName :: Arity -> Name
- cTupleDataConNames :: [Name]
- cTupleSelId :: ConTag -> Arity -> Id
- cTupleSelIdName :: ConTag -> Arity -> Name
- anyTyCon :: TyCon
- anyTy :: Type
- anyTypeOfKind :: Kind -> Type
- makeRecoveryTyCon :: TyCon -> TyCon
- mkSumTy :: [Type] -> Type
- sumTyCon :: Arity -> TyCon
- sumDataCon :: ConTag -> Arity -> DataCon
- 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

# Helper functions defined here

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

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

# All wired in things

wiredInTyCons :: [TyCon] Source #

isBuiltInOcc_maybe :: OccName -> Maybe Name Source #

Built-in syntax isn't "in scope" so these OccNames map to wired-in Names with BuiltInSyntax. However, this should only be necessary while resolving names produced by Template Haskell splices since we take care to encode built-in syntax names specially in interface files. See Note [Symbol table representation of names].

Moreover, there is no need to include names of things that the user can't write (e.g. type representation bindings like $tc(,,,)).

isPunOcc_maybe :: Module -> OccName -> Maybe Name Source #

# Bool

boolTy :: Type Source #

boolTyCon :: TyCon Source #

boolTyCon_RDR :: RdrName Source #

boolTyConName :: Name Source #

trueDataCon :: DataCon Source #

trueDataConId :: Id Source #

true_RDR :: RdrName Source #

falseDataCon :: DataCon Source #

falseDataConId :: Id Source #

false_RDR :: RdrName Source #

promotedFalseDataCon :: TyCon Source #

promotedTrueDataCon :: TyCon Source #

# Ordering

orderingTyCon :: TyCon Source #

ordLTDataCon :: DataCon Source #

ordLTDataConId :: Id Source #

ordEQDataCon :: DataCon Source #

ordEQDataConId :: Id Source #

ordGTDataCon :: DataCon Source #

ordGTDataConId :: Id Source #

promotedLTDataCon :: TyCon Source #

promotedEQDataCon :: TyCon Source #

promotedGTDataCon :: TyCon Source #

# Boxing primitive types

boxingDataCon :: Type -> BoxingInfo b Source #

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 Source #

Constructors

BI_NoBoxNeeded |
BI_NoBoxAvailable |
BI_Box |

Fields

- bi_data_con :: DataCon
- bi_inst_con :: Expr b
- bi_boxed_type :: Type

# Char

charTyCon :: TyCon Source #

charDataCon :: DataCon Source #

charTyCon_RDR :: RdrName Source #

charTy :: Type Source #

stringTy :: Type Source #

charTyConName :: Name Source #

stringTyCon_RDR :: RdrName Source #

# Double

doubleTyCon :: TyCon Source #

doubleDataCon :: DataCon Source #

doubleTy :: Type Source #

doubleTyConName :: Name Source #

# Float

floatTyCon :: TyCon Source #

floatDataCon :: DataCon Source #

floatTy :: Type Source #

floatTyConName :: Name Source #

# Int

intTyCon :: TyCon Source #

intDataCon :: DataCon Source #

intTyCon_RDR :: RdrName Source #

intDataCon_RDR :: RdrName Source #

intTyConName :: Name Source #

intTy :: Type Source #

# Word

wordTyCon :: TyCon Source #

wordDataCon :: DataCon Source #

wordTyConName :: Name Source #

wordTy :: Type Source #

# Word8

word8TyCon :: TyCon Source #

word8DataCon :: DataCon Source #

word8Ty :: Type Source #

# List

listTyCon :: TyCon Source #

listTyCon_RDR :: RdrName Source #

listTyConName :: Name Source #

listTyConKey :: Unique Source #

nilDataCon :: DataCon Source #

nilDataConName :: Name Source #

nilDataConKey :: Unique Source #

consDataCon_RDR :: RdrName Source #

consDataCon :: DataCon Source #

consDataConName :: Name Source #

promotedNilDataCon :: TyCon Source #

promotedConsDataCon :: TyCon Source #

mkListTy :: Type -> Type Source #

mkPromotedListTy Source #

Arguments

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

Make a *promoted* list.

# Maybe

maybeTyCon :: TyCon Source #

maybeTyConName :: Name Source #

nothingDataCon :: DataCon Source #

nothingDataConName :: Name Source #

promotedNothingDataCon :: TyCon Source #

justDataCon :: DataCon Source #

justDataConName :: Name Source #

promotedJustDataCon :: TyCon Source #

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

mkMaybeTy :: Type -> Kind Source #

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

# Tuples

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

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 Source #

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 Source #

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 Source #

tupleTyCon :: Boxity -> Arity -> TyCon Source #

tupleDataCon :: Boxity -> Arity -> DataCon Source #

tupleTyConName :: TupleSort -> Arity -> Name Source #

tupleDataConName :: Boxity -> Arity -> Name Source #

promotedTupleDataCon :: Boxity -> Arity -> TyCon Source #

unitTyCon :: TyCon Source #

unitDataCon :: DataCon Source #

unitDataConId :: Id Source #

unitTy :: Type Source #

unitTyConKey :: Unique Source #

soloTyCon :: TyCon Source #

pairTyCon :: TyCon Source #

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

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

unboxedUnitTy :: Type Source #

unboxedUnitTyCon :: TyCon Source #

unboxedUnitDataCon :: DataCon Source #

unboxedTupleKind :: [Type] -> Kind Source #

Specialization of `unboxedTupleSumKind` for tuples

unboxedSumKind :: [Type] -> Kind Source #

Specialization of `unboxedTupleSumKind` for sums

filterCTuple :: RdrName -> RdrName Source #

Replaces constraint tuple names with corresponding boxed ones.

mkConstraintTupleTy :: [Type] -> Type Source #

## Constraint tuples

cTupleTyCon :: Arity -> TyCon Source #

cTupleTyConName :: Arity -> Name Source #

cTupleTyConNames :: [Name] Source #

isCTupleTyConName :: Name -> Bool Source #

cTupleTyConNameArity_maybe :: Name -> Maybe Arity Source #

If the given name is that of a constraint tuple, return its arity.

cTupleDataCon :: Arity -> DataCon Source #

cTupleDataConName :: Arity -> Name Source #

cTupleDataConNames :: [Name] Source #

cTupleSelId :: ConTag -> Arity -> Id Source #

cTupleSelIdName :: ConTag -> Arity -> Name Source #

# Any

anyTyCon :: TyCon Source #

anyTy :: Type Source #

anyTypeOfKind :: Kind -> Type Source #

# Recovery TyCon

makeRecoveryTyCon :: TyCon -> TyCon Source #

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

# Sums

mkSumTy :: [Type] -> Type Source #

sumTyCon :: Arity -> TyCon Source #

Type constructor for n-ary unboxed sum.

sumDataCon :: ConTag -> Arity -> DataCon Source #

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

# Kinds

typeSymbolKindCon :: TyCon Source #

typeSymbolKind :: Kind Source #

isLiftedTypeKindTyConName :: Name -> Bool Source #

typeToTypeKind :: Type Source #

liftedRepTyCon :: TyCon Source #

    type LiftedRep = 'BoxedRep 'Lifted

unliftedRepTyCon :: TyCon Source #

    type UnliftedRep = 'BoxedRep 'Unlifted

tYPETyCon :: TyCon Source #

tYPETyConName :: Name Source #

tYPEKind :: Type Source #

cONSTRAINTTyCon :: TyCon Source #

cONSTRAINTTyConName :: Name Source #

cONSTRAINTKind :: Type Source #

constraintKind :: Kind Source #

liftedTypeKind :: Type Source #

unliftedTypeKind :: Type Source #

zeroBitTypeKind :: Type Source #

constraintKindTyCon :: TyCon Source #

liftedTypeKindTyCon :: TyCon Source #

unliftedTypeKindTyCon :: TyCon Source #

constraintKindTyConName :: Name Source #

liftedTypeKindTyConName :: Name Source #

unliftedTypeKindTyConName :: Name Source #

liftedRepTyConName :: Name Source #

unliftedRepTyConName :: Name Source #

# Equality predicates

heqTyCon :: TyCon Source #

heqTyConName :: Name Source #

heqClass :: Class Source #

heqDataCon :: DataCon Source #

eqTyCon :: TyCon Source #

eqTyConName :: Name Source #

eqClass :: Class Source #

eqDataCon :: DataCon Source #

eqTyCon_RDR :: RdrName Source #

coercibleTyCon :: TyCon Source #

coercibleTyConName :: Name Source #

coercibleDataCon :: DataCon Source #

coercibleClass :: Class Source #

# RuntimeRep and friends

runtimeRepTyCon :: TyCon Source #

vecCountTyCon :: TyCon Source #

vecElemTyCon :: TyCon Source #

boxedRepDataConTyCon :: TyCon Source #

runtimeRepTy :: Type Source #

liftedRepTy :: RuntimeRepType Source #

unliftedRepTy :: RuntimeRepType Source #

zeroBitRepTy :: RuntimeRepType Source #

vecRepDataConTyCon :: TyCon Source #

tupleRepDataConTyCon :: TyCon Source #

sumRepDataConTyCon :: TyCon Source #

# Levity

levityTyCon :: TyCon Source #

levityTy :: Type Source #

liftedDataConTyCon :: TyCon Source #

unliftedDataConTyCon :: TyCon Source #

liftedDataConTy :: Type Source #

unliftedDataConTy :: Type Source #

intRepDataConTy :: RuntimeRepType Source #

int8RepDataConTy :: RuntimeRepType Source #

int16RepDataConTy :: RuntimeRepType Source #

int32RepDataConTy :: RuntimeRepType Source #

int64RepDataConTy :: RuntimeRepType Source #

wordRepDataConTy :: RuntimeRepType Source #

word8RepDataConTy :: RuntimeRepType Source #

word16RepDataConTy :: RuntimeRepType Source #

word32RepDataConTy :: RuntimeRepType Source #

word64RepDataConTy :: RuntimeRepType Source #

addrRepDataConTy :: RuntimeRepType Source #

floatRepDataConTy :: RuntimeRepType Source #

doubleRepDataConTy :: RuntimeRepType Source #

vec2DataConTy :: Type Source #

vec4DataConTy :: Type Source #

vec8DataConTy :: Type Source #

vec16DataConTy :: Type Source #

vec32DataConTy :: Type Source #

vec64DataConTy :: Type Source #

int8ElemRepDataConTy :: Type Source #

int16ElemRepDataConTy :: Type Source #

int32ElemRepDataConTy :: Type Source #

int64ElemRepDataConTy :: Type Source #

word8ElemRepDataConTy :: Type Source #

word16ElemRepDataConTy :: Type Source #

word32ElemRepDataConTy :: Type Source #

word64ElemRepDataConTy :: Type Source #

floatElemRepDataConTy :: Type Source #

doubleElemRepDataConTy :: Type Source #

# Multiplicity and friends

multiplicityTyConName :: Name Source #

oneDataConName :: Name Source #

manyDataConName :: Name Source #

multiplicityTy :: Type Source #

multiplicityTyCon :: TyCon Source #

oneDataCon :: DataCon Source #

manyDataCon :: DataCon Source #

oneDataConTy :: Type Source #

manyDataConTy :: Type Source #

oneDataConTyCon :: TyCon Source #

manyDataConTyCon :: TyCon Source #

multMulTyCon :: TyCon Source #

unrestrictedFunTyCon :: TyCon Source #

unrestrictedFunTyConName :: Name Source #

# Bignum

integerTy :: Type Source #

integerTyCon :: TyCon Source #

integerTyConName :: Name Source #

integerISDataCon :: DataCon Source #

integerISDataConName :: Name Source #

integerIPDataCon :: DataCon Source #

integerIPDataConName :: Name Source #

integerINDataCon :: DataCon Source #

integerINDataConName :: Name Source #

naturalTy :: Type Source #

naturalTyCon :: TyCon Source #

naturalTyConName :: Name Source #

naturalNSDataCon :: DataCon Source #

naturalNSDataConName :: Name Source #

naturalNBDataCon :: DataCon Source #

naturalNBDataConName :: Name Source #