ghc-10.0.0.20260917: The GHC API
Safe HaskellNone
LanguageGHC2024

GHC.Unit.External.Validate

Synopsis

Validation of unit databases

validateDatabase :: [IgnorePackageFlag] -> UnitInfoMap -> (UnitInfoMap, UnusableUnits, [SCC UnitInfo]) Source #

Validates a database, removing unusable units from it (this includes removing units that the user has explicitly ignored.) Our general strategy:

  1. Remove all broken units (dangling dependencies)
  2. Remove all units that are cyclic
  3. Apply ignore flags
  4. Remove all units which have deps with mismatching ABIs

data UnusableUnit Source #

A unusable unit module origin

Constructors

UnusableUnit 

Fields

data UnusableUnitReason Source #

The reason why a unit is unusable.

Constructors

IgnoredWithFlag

We ignored it explicitly using -ignore-package.

BrokenDependencies [UnitId]

This unit transitively depends on a unit that was never present in any of the provided databases.

CyclicDependencies [UnitId]

This unit transitively depends on a unit involved in a cycle. Note that the list of UnitId reports the direct dependencies of this unit that (transitively) depended on the cycle, and not the actual cycle itself (which we report separately at high verbosity.)

IgnoredDependencies [UnitId]

This unit transitively depends on a unit which was ignored.

ShadowedDependencies [UnitId]

This unit transitively depends on a unit which was shadowed by an ABI-incompatible unit.

Instances

Instances details
Outputable UnusableUnitReason Source # 
Instance details

Defined in GHC.Unit.External.Validate

Package resolver

findPackages :: UnitPrecedenceMap -> UnitInfoMap -> PackageArg -> [UnitInfo] -> UnusableUnits -> Either [(UnitInfo, UnusableUnitReason)] [UnitInfo] Source #

Like selectPackages, but doesn't return a list of unmatched packages. Furthermore, any packages it returns are *renamed* if the UnitArg has a renaming associated with it.

Unit database closure validation

closeUnitDeps :: UnitInfoMap -> [(UnitId, Maybe UnitId)] -> MaybeErr UnitErr [UnitId] Source #

Takes a list of UnitIds (and their "parent" dependency, used for error messages), and returns the list with dependencies included, in reverse dependency order (a units appears before those it depends on).

closeUnitDeps' :: UnitInfoMap -> [UnitId] -> [(UnitId, Maybe UnitId)] -> MaybeErr UnitErr [UnitId] Source #

Similar to closeUnitDeps but takes a list of already loaded units as an additional argument.

Utils