Changes between Version 16 and Version 17 of Commentary/Compiler/EntityTypes


Ignore:
Timestamp:
May 16, 2016 6:06:27 PM (3 years ago)
Author:
ezyang
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/EntityTypes

    v16 v17  
    2525All these data types are implemented as a big record of information that tells you everything about the entity.  For example, a {{{TyCon}}} contains a list of its data constructors; a {{{DataCon}}} contains its type (which mentions its {{{TyCon}}}); a {{{Class}}} contains the {{{Id}}}s of all its method selectors; and an {{{Id}}} contains its type (which mentions type constructors and classes). 
    2626
    27 So you can see that the GHC data structures for entities is a ''graph'' not tree: everything points to everything else.  This makes it very convenient for the consumer, because there are accessor functions with simple types, such as {{{idType :: Id -> Type}}}.  But it means that there has to be some tricky almost-circular programming ("knot-tying") in the type checker, which constructs the entities.
     27So you can see that the GHC data structures for entities is a ''graph'' not tree: everything points to everything else.  This makes it very convenient for the consumer, because there are accessor functions with simple types, such as {{{idType :: Id -> Type}}}.  But it means that there has to be some tricky almost-circular programming ("knot-tying") in the type checker, which constructs the entities. See [wiki:Commentary/Compiler/TyingTheKnot tying the knot] for more details on this process.
    2828
    2929== Type variables and term variables ==