HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleghc-9.10.3GHC2021

GHC.Unit.Module.Deps

Dependencies and Usage of a module

  • 3 types
  • 13 values
  • Packageghc-9.10.3
  • Exports16
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceDeps.hs
datadata Dependencies
#

Dependency information about ALL modules and packages below this one in the import hierarchy. This is the serialisable version of ImportAvails.

Invariant: the dependencies of a module M never includes M.

Invariant: none of the lists contain duplicates.

Invariant: lists are ordered canonically (e.g. using stableModuleCmp)

See Note [Transitive Information in Dependencies]

Instances2Eq, Binary

All packages directly imported by this module I.e. packages to which this module's direct imports belong. Does not include other home units when using multiple home units. Modules from these units will go in dep_direct_mods

valuedep_orphs :: Dependencies -> [Module]
#

Transitive closure of orphan modules (whether home or external pkg).

(Possible optimization: don't include family instance orphans as they are anyway included in dep_finsts. But then be careful about code which relies on dep_orphs having the complete list!) This does NOT include us, unlike imp_orphs.

valuedep_finsts :: Dependencies -> [Module]
#

Transitive closure of depended upon modules which contain family instances (whether home or external). This is used by checkFamInstConsistency. This does NOT include us, unlike imp_finsts. See Note [The type family instance consistency story].

All modules which have boot files below this one, and whether we should use the boot file or not. This information is only used to populate the eps_is_boot field. See Note [Structure of dep_boot_mods]

datadata Usage
#

Records modules for which changes may force recompilation of this module See wiki: https://gitlab.haskell.org/ghc/ghc/wikis/commentary/compiler/recompilation-avoidance

This differs from Dependencies. A module X may be in the dep_mods of this module (via an import chain) but if we don't use anything from X it won't appear in our Usage

Constructors

Instances2Eq, Binary
  • Eq UsageDefined in ghc-9.10.3 · GHC.Unit.Module.Deps
  • Binary UsageDefined in ghc-9.10.3 · GHC.Unit.Module.Deps
datadata ImportAvails
#

ImportAvails summarises what was imported from where, irrespective of whether the imported things are actually used or not. It is used:

  • when processing the export list,

  • when constructing usage info for the interface file,

  • to identify the list of directly imported modules for initialisation purposes and for optimised overlap checking of family instances,

  • when figuring out what things are really unused

Constructors

  • ImportAvails
    • imp_mods :: ImportedMods

      Domain is all directly-imported modules

      See the documentation on ImportedModsVal in GHC.Unit.Module.Imported for the meaning of the fields.

      We need a full ModuleEnv rather than a ModuleNameEnv here, because we might be importing modules of the same name from different packages. (currently not the case, but might be in the future).

    • imp_direct_dep_mods :: InstalledModuleEnv ModuleNameWithIsBoot

      Home-package modules directly imported by the module being compiled.

    • imp_dep_direct_pkgs :: Set UnitId

      Packages directly needed by the module being compiled

    • imp_trust_own_pkg :: Bool

      Do we require that our own package is trusted? This is to handle efficiently the case where a Safe module imports a Trustworthy module that resides in the same package as it. See Note [Trust Own Package] in GHC.Rename.Names

    • imp_trust_pkgs :: Set UnitId

      This records the packages the current module needs to trust for Safe Haskell compilation to succeed. A package is required to be trusted if we are dependent on a trustworthy module in that package. See Note [Tracking Trust Transitively] in GHC.Rename.Names

    • imp_boot_mods :: InstalledModuleEnv ModuleNameWithIsBoot

      Domain is all modules which have hs-boot files, and whether we should import the boot version of interface file. Only used in one-shot mode to populate eps_is_boot.

    • imp_sig_mods :: [ModuleName]

      Signature modules below this one

    • imp_orphs :: [Module]

      Orphan modules below us in the import tree (and maybe including us for imported modules)

    • imp_finsts :: [Module]

      Family instance modules below us in the import tree (and maybe including us for imported modules)