Simon Peyton Jones pushed to branch wip/spj-reinstallable-base at Glasgow Haskell Compiler / GHC
Commits:
-
ac6b06ae
by Simon Peyton Jones at 2026-03-17T15:10:04+00:00
2 changed files:
Changes:
| ... | ... | @@ -39,7 +39,27 @@ the big-num package or (for plugins) the ghc package. |
| 39 | 39 | |
| 40 | 40 | Note [Overview of known-key names]
|
| 41 | 41 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 42 | -TODO -- write this Note!
|
|
| 42 | +A "known-key" name is one
|
|
| 43 | + * whose Unique and OccName are baked into GHC
|
|
| 44 | + * but that's all that GHC knows about it
|
|
| 45 | +In particular, GHC does /not/ know in which module the entity
|
|
| 46 | +is defined.
|
|
| 47 | + |
|
| 48 | +Example: the `Eq` class has OccName "Eq" and unique `eqClassKey`.
|
|
| 49 | +It happens to be defined in ghc-internal:GHC.Internal.Classes,
|
|
| 50 | +but GHC does not know that.
|
|
| 51 | + |
|
| 52 | +There are several different reasons that GHC might want to refer
|
|
| 53 | +to a known-key Name:
|
|
| 54 | + |
|
| 55 | +* When desugaring, the desugarer wants to refer to a particular
|
|
| 56 | + class, type, or function. It does this via (e.g.)
|
|
| 57 | + dsLookupTyKnownKeyTyCon :: Unique -> DsM TyCon
|
|
| 58 | + |
|
| 59 | +* When solving a constraint like (Typeable ty), which has built-in
|
|
| 60 | + instances, GHC needs to know whether this is the actual class
|
|
| 61 | + Typeable, not
|
|
| 62 | + |
|
| 43 | 63 | |
| 44 | 64 | Note [Known-key names] <---- OLD VERSION
|
| 45 | 65 | ~~~~~~~~~~~~~~~~~~~~~~
|
| 1 | -{-# LANGUAGE NoImplicitKnownKeyNames #-}
|
|
| 2 | 1 | -- |
|
| 3 | 2 | --
|
| 4 | 3 | -- Module : GHC.KnownKeyNames
|