GHC.Unit.Module.Deps

ghc-9.2.1: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Unit.Module.Deps

Description

Dependencies and Usage of a module

Synopsis

- data Dependencies = Deps {
  - dep_mods :: [ModuleNameWithIsBoot]
  - dep_pkgs :: [(UnitId, Bool)]
  - dep_orphs :: [Module]
  - dep_finsts :: [Module]
  - dep_plgins :: [ModuleName]
  }
- data Usage
  - = UsagePackageModule {
    - usg_mod :: Module
    - usg_mod_hash :: Fingerprint
    - usg_safe :: IsSafeImport
    }
  - | UsageHomeModule {
    - usg_mod_name :: ModuleName
    - usg_mod_hash :: Fingerprint
    - usg_entities :: [(OccName, Fingerprint)]
    - usg_exports :: Maybe Fingerprint
    - usg_safe :: IsSafeImport
    }
  - | UsageFile {
    - usg_file_path :: FilePath
    - usg_file_hash :: Fingerprint
    }
  - | UsageMergedRequirement {
    - usg_mod :: Module
    - usg_mod_hash :: Fingerprint
    }
- noDependencies :: Dependencies

# Documentation

data Dependencies Source #

Dependency information about ALL modules and packages below this one in the import hierarchy.

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

Invariant: none of the lists contain duplicates.

Constructors

Deps |
Fields dep_mods :: [ModuleNameWithIsBoot] All home-package modules transitively below this one I.e. modules that this one imports, or that are in the dep_mods of those directly-imported modules dep_pkgs :: [(UnitId, Bool)] All packages transitively below this module I.e. packages to which this module's direct imports belong, or that are in the dep_pkgs of those modules The bool indicates if the package is required to be trusted when the module is imported as a safe import (Safe Haskell). See Note [Tracking Trust Transitively] in GHC.Rename.Names dep_orphs :: [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`. dep_finsts :: [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]. dep_plgins :: [ModuleName] All the plugins used while compiling this module.

#### Instances

Instances details

Binary Dependencies Source # |
Instance details Defined in GHC.Unit.Module.Deps Methods put_ :: BinHandle -> Dependencies -> IO () Source # put :: BinHandle -> Dependencies -> IO (Bin Dependencies) Source # get :: BinHandle -> IO Dependencies Source #
Eq Dependencies Source # |
Instance details Defined in GHC.Unit.Module.Deps Methods (==) :: Dependencies -> Dependencies -> Bool # (/=) :: Dependencies -> Dependencies -> Bool #

data Usage Source #

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

UsagePackageModule | Module from another package
Fields usg_mod :: Module External package module depended on usg_mod_hash :: Fingerprint Cached module fingerprint usg_safe :: IsSafeImport Was this module imported as a safe import
UsageHomeModule | Module from the current package
Fields usg_mod_name :: ModuleName Name of the module usg_mod_hash :: Fingerprint Cached module fingerprint usg_entities :: [(OccName, Fingerprint)] Entities we depend on, sorted by occurrence name and fingerprinted. NB: usages are for parent names only, e.g. type constructors but not the associated data constructors. usg_exports :: Maybe Fingerprint Fingerprint for the export list of this module, if we directly imported it (and hence we depend on its export list) usg_safe :: IsSafeImport Was this module imported as a safe import
UsageFile |
Fields usg_file_path :: FilePath External file dependency. From a CPP #include or TH addDependentFile. Should be absolute. usg_file_hash :: Fingerprint `Fingerprint` of the file contents.
UsageMergedRequirement | A requirement which was merged into this one.
Fields usg_mod :: Module External package module depended on usg_mod_hash :: Fingerprint Cached module fingerprint

#### Instances

Instances details

Binary Usage Source # |
Instance details Defined in GHC.Unit.Module.Deps Methods put_ :: BinHandle -> Usage -> IO () Source # put :: BinHandle -> Usage -> IO (Bin Usage) Source # get :: BinHandle -> IO Usage Source #
Eq Usage Source # |
Instance details Defined in GHC.Unit.Module.Deps Methods (==) :: Usage -> Usage -> Bool # (/=) :: Usage -> Usage -> Bool #

noDependencies :: Dependencies Source #