| ... |
... |
@@ -235,8 +235,8 @@ How known-occ entities work |
|
235
|
235
|
|
|
236
|
236
|
* There are three flags that control the treatment of known entities:
|
|
237
|
237
|
-frebindable-known-names
|
|
238
|
|
- -fdefines-known-names
|
|
239
|
|
- -fexclude-known-define=wombat See wrinkle (KN2)
|
|
|
238
|
+ -fdefines-known-key-names
|
|
|
239
|
+ -fexclude-known-key-define=wombat See wrinkle (KN2)
|
|
240
|
240
|
Details in the following bullets.
|
|
241
|
241
|
|
|
242
|
242
|
* You initiate a known-occ lookup by calling
|
| ... |
... |
@@ -342,7 +342,7 @@ Wrinkles |
|
342
|
342
|
So we simply suppress an unused-import-decl warning if it has a "as Rebindable"
|
|
343
|
343
|
qualifier. See (UI1) in Note [Unused imports] in GHC.Rename.Names
|
|
344
|
344
|
|
|
345
|
|
-(KN2) The flag `-fdefines-known-names` is module-wide. But what if that module
|
|
|
345
|
+(KN2) The flag `-fdefines-known-key-names` is module-wide. But what if that module
|
|
346
|
346
|
happens to define an entity that /isn't/ a known-key entity, but /does/ share the
|
|
347
|
347
|
same OccName. For example:
|
|
348
|
348
|
module GHC.Internal.Data.Foldable where
|
| ... |
... |
@@ -350,11 +350,11 @@ Wrinkles |
|
350
|
350
|
module GHC.Internal.IsList where
|
|
351
|
351
|
class IsList l where { ...; toList :: l -> [Item l] }
|
|
352
|
352
|
Foldable is a known-key entity, so GHC.Internal.Data.Foldable must be compiled
|
|
353
|
|
- with `-fdefines-known-names`. But its `toList` method is /not/ known-key.
|
|
|
353
|
+ with `-fdefines-known-key-names`. But its `toList` method is /not/ known-key.
|
|
354
|
354
|
Rather, the `toList` from GHC.Internal.IsList is teh known-key entity.
|
|
355
|
355
|
|
|
356
|
356
|
So we compile GHC.Internal.Data.Foldable with
|
|
357
|
|
- -fexclude-known-define=toList
|
|
|
357
|
+ -fexclude-known-key-define=toList
|
|
358
|
358
|
|
|
359
|
359
|
(KN3) We don't need to export wired-in entities from GHC.Essentials
|
|
360
|
360
|
because we (should) never look up a wired-in name via its key. That is,
|
| ... |
... |
@@ -388,10 +388,10 @@ Note [Recipe for adding a known-key name] |
|
388
|
388
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
389
|
389
|
To make `wombat` into a known-key name, do the following.
|
|
390
|
390
|
|
|
391
|
|
-* Ensure that the module M that defines `wombat` is compiled with `-fdefines-known-names`.
|
|
|
391
|
+* Ensure that the module M that defines `wombat` is compiled with `-fdefines-known-key-names`.
|
|
392
|
392
|
|
|
393
|
393
|
* If M.hs has an `M.hs-boot` file, ensure that it too is compiled
|
|
394
|
|
- with `-fdefines-known-names`.
|
|
|
394
|
+ with `-fdefines-known-key-names`.
|
|
395
|
395
|
|
|
396
|
396
|
* Ensure that the module `GHC.Essentials` exports `wombat`.
|
|
397
|
397
|
|