GHC.Builtin.Utils

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

Safe Haskell | Ignore
Language | GHC2021

GHC.Builtin.Utils

Contents

- Known-key names
  - Internal use
- Miscellaneous
- Random other things
- Class categories

Description

The `GHC.Builtin.Utils` interface to the compiler's prelude knowledge.

This module serves as the central gathering point for names which the compiler knows something about. This includes functions for,

- discerning whether a `Name` is known-key
- given a `Unique`, looking up its corresponding known-key `Name`

See Note [Known-key names] and Note [About wired-in things] for information about the two types of prelude things in GHC.

Synopsis

- isKnownKeyName :: Name -> Bool
- lookupKnownKeyName :: Unique -> Maybe Name
- lookupKnownNameInfo :: Name -> SDoc
- knownKeyNames :: [Name]
- wiredInIds :: [Id]
- ghcPrimIds :: [Id]
- ghcPrimExports :: [IfaceExport]
- ghcPrimDeclDocs :: Docs
- ghcPrimWarns :: Warnings a
- ghcPrimFixities :: [(OccName, Fixity)]
- maybeCharLikeCon :: DataCon -> Bool
- maybeIntLikeCon :: DataCon -> Bool
- isNumericClass :: Class -> Bool
- isStandardClass :: Class -> Bool

# Known-key names

isKnownKeyName :: Name -> Bool #

Is a `Name` known-key?

lookupKnownKeyName :: Unique -> Maybe Name #

Given a `Unique` lookup its associated `Name` if it corresponds to a known-key thing.

lookupKnownNameInfo :: Name -> SDoc #

Given a `Unique` lookup any associated arbitrary SDoc's to be displayed by GHCi's ':info' command.

## Internal use

`knownKeyNames` is exported to seed the original name cache only; if you find yourself wanting to look at it you might consider using `lookupKnownKeyName` or `isKnownKeyName`.

knownKeyNames :: [Name] #

This list is used to ensure that when you say "Prelude.map" in your source code, or in an interface file, you get a Name with the correct known key (See Note [Known-key names] in GHC.Builtin.Names)

# Miscellaneous

wiredInIds :: [Id] #

ghcPrimIds :: [Id] #

ghcPrimExports :: [IfaceExport] #

ghcPrimDeclDocs :: Docs #

ghcPrimWarns :: Warnings a #

ghcPrimFixities :: [(OccName, Fixity)] #

# Random other things

maybeCharLikeCon :: DataCon -> Bool #

maybeIntLikeCon :: DataCon -> Bool #

# Class categories

isNumericClass :: Class -> Bool #

isStandardClass :: Class -> Bool #