... | @@ -13,13 +13,13 @@ There are three categories of entities that GHC "knows about"; that is, informat |
... | @@ -13,13 +13,13 @@ There are three categories of entities that GHC "knows about"; that is, informat |
|
A **Wired-in thing** is fully known to GHC. Most of these are `TyCon`s such as `Bool`. It is very convenient to simply be able to refer to `boolTyCon :: TyCon` without having to look it up in an environment.
|
|
A **Wired-in thing** is fully known to GHC. Most of these are `TyCon`s such as `Bool`. It is very convenient to simply be able to refer to `boolTyCon :: TyCon` without having to look it up in an environment.
|
|
|
|
|
|
|
|
|
|
All [primitive types](commentary/compiler/type-type#classifying-types) are wired-in things, and have wired-in `Name`s. The primitive types (and their `Names`) are all defined in [compiler/prelude/TysPrim.hs](/trac/ghc/browser/ghc/compiler/prelude/TysPrim.hs).
|
|
All [primitive types](commentary/compiler/type-type#classifying-types) are wired-in things, and have wired-in `Name`s. The primitive types (and their `Names`) are all defined in [compiler/prelude/TysPrim.hs](/ghc/ghc/tree/master/ghc/compiler/prelude/TysPrim.hs).
|
|
|
|
|
|
|
|
|
|
The non-primitive wired-in type constructors are defined in [compiler/prelude/TysWiredIn.hs](/trac/ghc/browser/ghc/compiler/prelude/TysWiredIn.hs). There are a handful of wired-in `Id`s in [compiler/basicTypes/MkId.hs](/trac/ghc/browser/ghc/compiler/basicTypes/MkId.hs). There are no wired-in classes (they are too complicated).
|
|
The non-primitive wired-in type constructors are defined in [compiler/prelude/TysWiredIn.hs](/ghc/ghc/tree/master/ghc/compiler/prelude/TysWiredIn.hs). There are a handful of wired-in `Id`s in [compiler/basicTypes/MkId.hs](/trac/ghc/browser/ghc/compiler/basicTypes/MkId.hs). There are no wired-in classes (they are too complicated).
|
|
|
|
|
|
|
|
|
|
All the non-primitive wired-in things are *also* defined in GHC's libraries, because even though GHC knows about them we still need to generate code for them. For example, `Bool` is a wired-in type constructor, but it is still defined in `GHC.Base` because we need the info table etc for the data constructors. Arbitrarily bad things will happen if the wired-in definition in [compiler/prelude/TysWiredIn.hs](/trac/ghc/browser/ghc/compiler/prelude/TysWiredIn.hs) differs from that in the library module.
|
|
All the non-primitive wired-in things are *also* defined in GHC's libraries, because even though GHC knows about them we still need to generate code for them. For example, `Bool` is a wired-in type constructor, but it is still defined in `GHC.Base` because we need the info table etc for the data constructors. Arbitrarily bad things will happen if the wired-in definition in [compiler/prelude/TysWiredIn.hs](/ghc/ghc/tree/master/ghc/compiler/prelude/TysWiredIn.hs) differs from that in the library module.
|
|
|
|
|
|
|
|
|
|
All wired-in things have a `WiredIn``Name` (see [Names](commentary/compiler/name-type)), which in turn contains the thing. See [a case study of Bool implementation](commentary/compiler/case-studies/bool) for more details.
|
|
All wired-in things have a `WiredIn``Name` (see [Names](commentary/compiler/name-type)), which in turn contains the thing. See [a case study of Bool implementation](commentary/compiler/case-studies/bool) for more details.
|
... | @@ -34,7 +34,7 @@ A **known-key thing** has a fixed, pre-allocated `Unique` or **key**. They shou |
... | @@ -34,7 +34,7 @@ A **known-key thing** has a fixed, pre-allocated `Unique` or **key**. They shou |
|
- Its `Unique`
|
|
- Its `Unique`
|
|
|
|
|
|
|
|
|
|
Almost all known-key names are defined in [compiler/prelude/PrelNames.hs](/trac/ghc/browser/ghc/compiler/prelude/PrelNames.hs); for example: `PrelNames.eqClassName :: Name`.
|
|
Almost all known-key names are defined in [compiler/prelude/PrelNames.hs](/ghc/ghc/tree/master/ghc/compiler/prelude/PrelNames.hs); for example: `PrelNames.eqClassName :: Name`.
|
|
|
|
|
|
|
|
|
|
The point about known-key things is that GHC knows its *name*, but not its *definition*. The definition must still be read from an interface file as usual. The known key just allows an efficient lookup in the environment.
|
|
The point about known-key things is that GHC knows its *name*, but not its *definition*. The definition must still be read from an interface file as usual. The known key just allows an efficient lookup in the environment.
|
... | @@ -68,5 +68,5 @@ An **Orig RdrName thing** has a top-level definition of a `RdrName`, using the ` |
... | @@ -68,5 +68,5 @@ An **Orig RdrName thing** has a top-level definition of a `RdrName`, using the ` |
|
- Its `OccName`
|
|
- Its `OccName`
|
|
|
|
|
|
|
|
|
|
Again, almost all of these are in [compiler/prelude/PrelNames.hs](/trac/ghc/browser/ghc/compiler/prelude/PrelNames.hs).
|
|
Again, almost all of these are in [compiler/prelude/PrelNames.hs](/ghc/ghc/tree/master/ghc/compiler/prelude/PrelNames.hs).
|
|
Example: `PrelNames.not_RDR :: RdrName`. |
|
Example: `PrelNames.not_RDR :: RdrName`. |