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

GHC.Builtin.Types

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

Helper functions defined here

All wired in things

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]

Bool

Ordering

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]

Char

Double

Float

Int

Word

Word8

List

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

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].

unboxedTupleKind :: [Type] -> Kind #

Specialization of unboxedTupleSumKind for tuples

unboxedSumKind :: [Type] -> Kind #

Specialization of unboxedTupleSumKind for sums

Constraint tuples

Any

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.

Kinds

liftedRepTyCon :: TyCon #

type LiftedRep = 'BoxedRep 'Lifted

unliftedRepTyCon :: TyCon #

type UnliftedRep = 'BoxedRep 'Unlifted

Equality predicates

RuntimeRep and friends

Levity

Multiplicity and friends

Bignum

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].