| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
GHC.Unit.External.Validate
Synopsis
- validateDatabase :: [IgnorePackageFlag] -> UnitInfoMap -> (UnitInfoMap, UnusableUnits, [SCC UnitInfo])
- reportUnusable :: Logger -> UnusableUnits -> IO ()
- type UnusableUnits = UniqMap UnitId (UnitInfo, UnusableUnitReason)
- data UnusableUnit = UnusableUnit {
- uuUnit :: !Unit
- uuReason :: !UnusableUnitReason
- uuIsReexport :: !Bool
- data UnusableUnitReason
- pprReason :: SDoc -> UnusableUnitReason -> SDoc
- findPackages :: UnitPrecedenceMap -> UnitInfoMap -> PackageArg -> [UnitInfo] -> UnusableUnits -> Either [(UnitInfo, UnusableUnitReason)] [UnitInfo]
- selectPackages :: UnitPrecedenceMap -> PackageArg -> [UnitInfo] -> UnusableUnits -> Either [(UnitInfo, UnusableUnitReason)] ([UnitInfo], [UnitInfo])
- data UnitErr
- = CloseUnitErr !UnitId !(Maybe UnitId)
- | PackageFlagErr !PackageFlag ![(UnitInfo, UnusableUnitReason)]
- | TrustFlagErr !TrustFlag ![(UnitInfo, UnusableUnitReason)]
- mayThrowUnitErr :: MaybeErr UnitErr a -> IO a
- closeUnitDeps :: UnitInfoMap -> [(UnitId, Maybe UnitId)] -> MaybeErr UnitErr [UnitId]
- closeUnitDeps' :: UnitInfoMap -> [UnitId] -> [(UnitId, Maybe UnitId)] -> MaybeErr UnitErr [UnitId]
- ignoreUnits :: [IgnorePackageFlag] -> [UnitInfo] -> UnusableUnits
- pprFlag :: PackageFlag -> SDoc
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:
- Remove all broken units (dangling dependencies)
- Remove all units that are cyclic
- Apply ignore flags
- Remove all units which have deps with mismatching ABIs
reportUnusable :: Logger -> UnusableUnits -> IO () Source #
type UnusableUnits = UniqMap UnitId (UnitInfo, UnusableUnitReason) Source #
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 |
| 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 |
| 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
| Outputable UnusableUnitReason Source # | |
Defined in GHC.Unit.External.Validate Methods ppr :: UnusableUnitReason -> SDoc Source # | |
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.
selectPackages :: UnitPrecedenceMap -> PackageArg -> [UnitInfo] -> UnusableUnits -> Either [(UnitInfo, UnusableUnitReason)] ([UnitInfo], [UnitInfo]) Source #
Unit database closure validation
Constructors
| CloseUnitErr !UnitId !(Maybe UnitId) | |
| PackageFlagErr !PackageFlag ![(UnitInfo, UnusableUnitReason)] | |
| TrustFlagErr !TrustFlag ![(UnitInfo, UnusableUnitReason)] |
Instances
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
ignoreUnits :: [IgnorePackageFlag] -> [UnitInfo] -> UnusableUnits Source #
pprFlag :: PackageFlag -> SDoc Source #