... | ... | @@ -15,11 +15,8 @@ Look at the picture first. The yellow boxes are compiler passes, while the blue |
|
|
- `HsSyn` is parameterised over the types of the variables it contains. The first three passes (the front end) of the compiler work like this:
|
|
|
|
|
|
- The **parser** produces `HsSyn` parameterised by **[RdrName](commentary/compiler/rdr-name-type)**. To a first approximation, a `RdrName` is just a string.
|
|
|
- The **renamer** transforms this to `HsSyn` parameterised by **[Name](commentary/compiler/name-type)**. To a first appoximation, a `Name` is a string plus a `Unique` (number) that uniquely identifies it.
|
|
|
- The **typechecker** transforms this further, to `HsSyn` parameterised by **[Id](commentary/compiler/entity-types)**. To a first approximation, an `Id` is a `Name` plus a type.
|
|
|
|
|
|
>
|
|
|
> In addition, the type-checker converts class declarations to `Class`es, and type declarations to `TyCon`s and `DataCon`s. And of course, the type-checker deals in `Type`s and `TyVar`s. The [data types for these entities](commentary/compiler/entity-types) (`Type`, `TyCon`, `Class`, `Id`, `TyVar`) are pervasive throughout the rest of the compiler.
|
|
|
- The **[renamer](commentary/compiler/renamer)** transforms this to `HsSyn` parameterised by **[Name](commentary/compiler/name-type)**. To a first appoximation, a `Name` is a string plus a `Unique` (number) that uniquely identifies it.
|
|
|
- The **typechecker** transforms this further, to `HsSyn` parameterised by **[Id](commentary/compiler/entity-types)**. To a first approximation, an `Id` is a `Name` plus a type. In addition, the type-checker converts class declarations to `Class`es, and type declarations to `TyCon`s and `DataCon`s. And of course, the type-checker deals in `Type`s and `TyVar`s. The [data types for these entities](commentary/compiler/entity-types) (`Type`, `TyCon`, `Class`, `Id`, `TyVar`) are pervasive throughout the rest of the compiler.
|
|
|
|
|
|
- The **desugarer** converts from the massive `HsSyn` type to [GHC's intermediate language, CoreSyn](commentary/compiler/core-syn-type). This data type is relatively tiny: just eight constructors.
|
|
|
|
... | ... | |