|
# Module Types
|
|
# Module Types
|
|
|
|
|
|
|
|
|
|
Here we attempt to describe some of the main data structures involved in GHC's representation and handling of Haksell modules. GHC uses a number of different data types to represent modules, for efficiency (some types load less information) and categorising how other modules relate to the one being compiled. Most these types are defined in [compiler/main/HscTypes.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/main/HscTypes.hs).
|
|
Here we attempt to describe some of the main data structures involved in GHC's representation and handling of Haksell modules. GHC uses a number of different data types to represent modules, for efficiency (some types load less information) and categorising how other modules relate to the one being compiled. Most these types are defined in [compiler/GHC/Driver/Types.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/GHC/Driver/Types.hs).
|
|
|
|
|
|
## Module
|
|
## Module
|
|
|
|
|
|
|
|
|
|
Location: [compiler/basicTypes/Module.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/basicTypes/Module.hs)
|
|
Location: [compiler/GHC/Unit/Module.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/GHC/Unit/Module.hs)
|
|
|
|
|
|
|
|
|
|
The **Module** data type is simply an identifier of a module; its fully qualified name.
|
|
The **Module** data type is simply an identifier of a module; its fully qualified name.
|
... | @@ -25,7 +25,7 @@ newtype ModuleName = ModuleName FastString |
... | @@ -25,7 +25,7 @@ newtype ModuleName = ModuleName FastString |
|
## ModIface
|
|
## ModIface
|
|
|
|
|
|
|
|
|
|
Location: [compiler/main/HscTypes.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/main/HscTypes.hs)
|
|
Location: [compiler/GHC/Driver/Types.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/GHC/Driver/Types.hs)
|
|
|
|
|
|
|
|
|
|
The **ModIface** data type is one of the fullest representations of a module. It is a complete representation of a modules interface file (**.hi**). It is this data structure that is serialised to produce a modules **.hi** file.
|
|
The **ModIface** data type is one of the fullest representations of a module. It is a complete representation of a modules interface file (**.hi**). It is this data structure that is serialised to produce a modules **.hi** file.
|
... | @@ -33,14 +33,14 @@ The **ModIface** data type is one of the fullest representations of a module. It |
... | @@ -33,14 +33,14 @@ The **ModIface** data type is one of the fullest representations of a module. It |
|
## ModDetails
|
|
## ModDetails
|
|
|
|
|
|
|
|
|
|
Location: [compiler/main/HscTypes.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/main/HscTypes.hs)
|
|
Location: [compiler/GHC/Driver/Types.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/GHC/Driver/Types.hs)
|
|
|
|
|
|
**ModDetails** is essentially a cache for information in the **ModIface** for home modules only. It stores information about a module after linking has taken place. **ModIface** stores information about a module before linking. Information stored in a **ModDetails** is created from a **ModIface**, typically during type checking.
|
|
**ModDetails** is essentially a cache for information in the **ModIface** for home modules only. It stores information about a module after linking has taken place. **ModIface** stores information about a module before linking. Information stored in a **ModDetails** is created from a **ModIface**, typically during type checking.
|
|
|
|
|
|
### ModGuts
|
|
### ModGuts
|
|
|
|
|
|
|
|
|
|
Location: [compiler/main/HscTypes.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/main/HscTypes.hs)
|
|
Location: [compiler/GHC/Driver/Types.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/GHC/Driver/Types.hs)
|
|
|
|
|
|
|
|
|
|
A **ModGuts** is carried through the compiler, accumulating stuff as it goes. There is only one **ModGuts** at any time, the one for the module being compiled right now. Once it is compiled, a **ModIface** and **ModDetails** are extracted and the **ModGuts** is discarded.
|
|
A **ModGuts** is carried through the compiler, accumulating stuff as it goes. There is only one **ModGuts** at any time, the one for the module being compiled right now. Once it is compiled, a **ModIface** and **ModDetails** are extracted and the **ModGuts** is discarded.
|
... | @@ -48,7 +48,7 @@ A **ModGuts** is carried through the compiler, accumulating stuff as it goes. Th |
... | @@ -48,7 +48,7 @@ A **ModGuts** is carried through the compiler, accumulating stuff as it goes. Th |
|
## ModSummary
|
|
## ModSummary
|
|
|
|
|
|
|
|
|
|
Location: [compiler/main/HscTypes.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/main/HscTypes.hs)
|
|
Location: [compiler/GHC/Driver/Types.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/GHC/Driver/Types.hs)
|
|
|
|
|
|
|
|
|
|
A **ModSummary** stores a summary of a module that is suitable for recompilation checking. A **ModSummary** is a node in the compilation manager's dependency graph.
|
|
A **ModSummary** stores a summary of a module that is suitable for recompilation checking. A **ModSummary** is a node in the compilation manager's dependency graph.
|
... | @@ -56,7 +56,7 @@ A **ModSummary** stores a summary of a module that is suitable for recompilation |
... | @@ -56,7 +56,7 @@ A **ModSummary** stores a summary of a module that is suitable for recompilation |
|
## HomeModInfo
|
|
## HomeModInfo
|
|
|
|
|
|
|
|
|
|
Location: [compiler/main/HscTypes.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/main/HscTypes.hs)
|
|
Location: [compiler/GHC/Driver/Types.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/GHC/Driver/Types.hs)
|
|
|
|
|
|
|
|
|
|
A **HomeModInfo** stores information about a module in the package being compiled. It simply stores for the **ModIface**, **ModDetails** and linkage information about a single module.
|
|
A **HomeModInfo** stores information about a module in the package being compiled. It simply stores for the **ModIface**, **ModDetails** and linkage information about a single module.
|
... | @@ -64,7 +64,7 @@ A **HomeModInfo** stores information about a module in the package being compile |
... | @@ -64,7 +64,7 @@ A **HomeModInfo** stores information about a module in the package being compile |
|
## HomePackageTable
|
|
## HomePackageTable
|
|
|
|
|
|
|
|
|
|
Location: [compiler/main/HscTypes.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/main/HscTypes.hs)
|
|
Location: [compiler/GHC/Driver/Types.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/GHC/Driver/Types.hs)
|
|
|
|
|
|
|
|
|
|
The home package table describes already-compiled home-package modules, /excluding/ the module we are compiling right now.
|
|
The home package table describes already-compiled home-package modules, /excluding/ the module we are compiling right now.
|
... | @@ -72,7 +72,7 @@ The home package table describes already-compiled home-package modules, /excludi |
... | @@ -72,7 +72,7 @@ The home package table describes already-compiled home-package modules, /excludi |
|
## ExternalPackageState
|
|
## ExternalPackageState
|
|
|
|
|
|
|
|
|
|
Location: [compiler/main/HscTypes.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/main/HscTypes.hs)
|
|
Location: [compiler/GHC/Driver/Types.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/GHC/Driver/Types.hs)
|
|
|
|
|
|
|
|
|
|
Stores information about other packages that we have pulled in while compiling the current module. |
|
Stores information about other packages that we have pulled in while compiling the current module. |