Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,264
    • Issues 4,264
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 419
    • Merge Requests 419
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Wiki
    • Commentary
    • Compiler
  • module types

Last edited by Takenobu Tani Jun 11, 2020
Page history New page

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/GHC/Driver/Types.hs.

Module

Location: compiler/GHC/Unit/Module.hs

The Module data type is simply an identifier of a module; its fully qualified name.

-- | A Module is a pair of a 'PackageId' and a 'ModuleName'.
data Module = Module {
   modulePackageId :: !PackageId,  -- pkg-1.0
   moduleName      :: !ModuleName  -- A.B.C
  }
  deriving (Eq, Ord)

newtype ModuleName = ModuleName FastString

ModIface

Location: 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.

ModDetails

Location: 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.

ModGuts

Location: 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.

ModSummary

Location: 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.

HomeModInfo

Location: 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.

HomePackageTable

Location: compiler/GHC/Driver/Types.hs

The home package table describes already-compiled home-package modules, /excluding/ the module we are compiling right now.

ExternalPackageState

Location: compiler/GHC/Driver/Types.hs

Stores information about other packages that we have pulled in while compiling the current module.

Clone repository

GHC Home
GHC User's Guide

Joining In

Newcomers info
Mailing Lists & IRC
The GHC Team

Documentation

GHC Status Info
Working conventions
Building Guide
Debugging
Commentary

Wiki

Title Index
Recent Changes