Caches unit databases in-memory.
Moduleghc-10.0.0.20260917GHC2024
GHC.Unit.External.Database
- 4 types
- 10 values
- Packageghc-10.0.0.20260917
- Exports14
- LanguageGHC2024
- LicenceBSD-3-Clause
- SourceDatabase.hs
ExternalUnitDatabases
5 declarationsUnitDatabase and how to merge them.
5 declarationsUnit database entry.
Constructors
Instances1Outputable
Outputable u => Outputable (UnitDatabase u)Defined in ghc-10.0.0.20260917 · GHC.Unit.External.Database
Given a list of databases, merge them together, where
units with the same unit id in later databases override
earlier ones. This does NOT check if the resulting database
makes sense (that's done by validateDatabase).
For each unit, a mapping from uid -> i indicates that this
unit was brought into GHC by the ith -package-db flag on
the command line. We use this mapping to make sure we prefer
units that were defined later on the command line, if there
is an ambiguity.
This sorts a list of packages, putting "preferred" packages first. See compareByPreference for the semantics of "preference".
Returns GT if pkg should be preferred over pkg' when picking
which should be "active". Here is the order of preference:
First, prefer the latest version
If the versions are the same, prefer the package that came in the latest package database.
Pursuant to #12518, we could change this policy to, for example, remove the version preference, meaning that we would always prefer the units in later unit database.
Reading packages from disk.
4 declarationsRead the UnitDatabase at the given location.
Return the path of a package database from a PkgDbRef. Return Nothing when the user database filepath is expected but the latter doesn't exist.
NB: This logic is reimplemented in Cabal, so if you change it, make sure you update Cabal. (Or, better yet, dump it in the compiler info so Cabal can use the info.)