Wolfgang Jeltsch pushed to branch wip/spj-reinstallable-base2.rebased at Glasgow Haskell Compiler / GHC

Commits:

3 changed files:

Changes:

  • compiler/GHC/Builtin.hs
    ... ... @@ -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
     
    

  • compiler/GHC/Iface/Load.hs
    ... ... @@ -163,7 +163,7 @@ data KnownNameSource
    163 163
     
    
    164 164
       | KNS_FromModule
    
    165 165
            -- Look up the known-occ name in the export list of GHC.Essentials
    
    166
    -       -- This is the "normal path", and happens when -frebindable-key-name
    
    166
    +       -- This is the "normal path", and happens when -frebindable-known-names
    
    167 167
            -- is /not/ set
    
    168 168
     
    
    169 169
     instance Outputable KnownNameSource where
    

  • libraries/base/src/System/IO.hs
    ... ... @@ -187,6 +187,26 @@ module System.IO
    187 187
     
    
    188 188
     import GHC.Internal.System.IO (putStrLn, print)
    
    189 189
     
    
    190
    +import GHC.Essentials as Rebindable
    
    191
    +       (
    
    192
    +           Module (Module),
    
    193
    +           TrName (TrNameS),
    
    194
    +           TypeLitSort (TypeLitSymbol, TypeLitChar, TypeLitNat),
    
    195
    +           TyCon (TyCon),
    
    196
    +           KindRep
    
    197
    +           (
    
    198
    +               KindRepVar,
    
    199
    +               KindRepTYPE,
    
    200
    +               KindRepTypeLitS,
    
    201
    +               KindRepFun,
    
    202
    +               KindRepTyConApp,
    
    203
    +               KindRepApp
    
    204
    +           ),
    
    205
    +           fail,
    
    206
    +           Num,
    
    207
    +           fromInteger
    
    208
    +       )
    
    209
    +
    
    190 210
     import GHC.Base (Bool (False, True), otherwise, failIO)
    
    191 211
     import GHC.Err (errorWithoutStackTrace)
    
    192 212
     import GHC.List ((++), reverse, break)