... | ... | @@ -15,7 +15,7 @@ For each kind of Haskell entity (identifier, type variable, type constructor, da |
|
|
|
|
|
All of these entities have a `Name`, but that's about all they have in common. However they are sometimes treated uniformly:
|
|
|
|
|
|
- A **`TyThing`** ([compiler/types/TypeRep.hs](/trac/ghc/browser/ghc/compiler/types/TypeRep.hs)) is simply the sum of all four:
|
|
|
- A **`TyThing`** ([compiler/types/TypeRep.hs](/ghc/ghc/tree/master/ghc/compiler/types/TypeRep.hs)) is simply the sum of all four:
|
|
|
|
|
|
```wiki
|
|
|
data TyThing = AnId Id
|
... | ... | @@ -37,7 +37,7 @@ So you can see that the GHC data structures for entities is a *graph* not tree: |
|
|
## Type variables and term variables
|
|
|
|
|
|
|
|
|
Type variables and term variables are represented by a single data type, `Var`, thus ([compiler/basicTypes/Var.hs](/trac/ghc/browser/ghc/compiler/basicTypes/Var.hs)):
|
|
|
Type variables and term variables are represented by a single data type, `Var`, thus ([compiler/basicTypes/Var.hs](/ghc/ghc/tree/master/ghc/compiler/basicTypes/Var.hs)):
|
|
|
|
|
|
```wiki
|
|
|
type Id = Var
|
... | ... | @@ -51,7 +51,7 @@ It's incredibly convenient to use a single data type for both, rather than using |
|
|
- We only need one lambda constructor in Core: `Lam :: Var -> CoreExpr -> CoreExpr`.
|
|
|
|
|
|
|
|
|
The `Var` type distinguishes the two sorts of variable; indeed, it makes somewhat finer distinctions ([compiler/basicTypes/Var.hs](/trac/ghc/browser/ghc/compiler/basicTypes/Var.hs)):
|
|
|
The `Var` type distinguishes the two sorts of variable; indeed, it makes somewhat finer distinctions ([compiler/basicTypes/Var.hs](/ghc/ghc/tree/master/ghc/compiler/basicTypes/Var.hs)):
|
|
|
|
|
|
```wiki
|
|
|
data Var
|
... | ... | @@ -131,7 +131,7 @@ All the value bindings in the module being compiled (whether top level or not) a |
|
|
|
|
|
## `GlobalIdDetails` and implict Ids
|
|
|
|
|
|
`GlobalId`s are further classified by their `GlobalIdDetails`. This type is defined in [compiler/basicTypes/IdInfo.hs](/trac/ghc/browser/ghc/compiler/basicTypes/IdInfo.hs), because it mentions other structured types such as `DataCon`. Unfortunately it is *used* in Var.hs so there's a hi-boot knot to get it there. Anyway, here's the declaration (elided a little):
|
|
|
`GlobalId`s are further classified by their `GlobalIdDetails`. This type is defined in [compiler/basicTypes/IdInfo.hs](/ghc/ghc/tree/master/ghc/compiler/basicTypes/IdInfo.hs), because it mentions other structured types such as `DataCon`. Unfortunately it is *used* in Var.hs so there's a hi-boot knot to get it there. Anyway, here's the declaration (elided a little):
|
|
|
|
|
|
```wiki
|
|
|
data GlobalIdDetails
|
... | ... | |