Changes between Version 13 and Version 14 of Commentary/Compiler/WiredIn


Ignore:
Timestamp:
Jan 23, 2013 4:56:17 PM (15 months ago)
Author:
jstolarek
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/WiredIn

    v13 v14  
    2020All 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 [[GhcFile(compiler/prelude/TysWiredIn.lhs)]] differs from that in the library module. 
    2121 
    22 All wired-in things have a `WiredIn` `Name` (see [wiki:Commentary/Compiler/NameType Names]), which in turn contains the thing.  For example ([[GhcFile(compiler/prelude/TysWiredIn.lhs)]]): 
    23 {{{ 
    24 boolTyCon :: TyCon 
    25 boolTyCon = mkAlgTyCon boolTyConName ...more details... 
    26  
    27 boolTyConName :: Name 
    28 boolTyConName = mkWiredInName gHC_BASE (mkOccNameFS tcName FSLIT("Bool")) 
    29                               boolTyConKey Nothing 
    30                               (ATyCon boolTyCon) UserSyntax 
    31 }}} 
    32 Notice that the `TyCon` has a `Name` that contains the `TyCon`.  They each point to the other. 
     22All wired-in things have a `WiredIn` `Name` (see [wiki:Commentary/Compiler/NameType Names]), which in turn contains the thing.  See [wiki:Commentary/Compiler/CaseStudies/Bool a case study of Bool implementation] for more details. 
    3323 
    3424== Known-key things ==