Skip to content
  • Sylvain Henry's avatar
    Refactor package related code · 29c701c1
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    The package terminology is a bit of a mess. Cabal packages contain
    components. Instances of these components when built with some
    flags/options/dependencies are called units. Units are registered into
    package databases and their metadata are called PackageConfig.
    
    GHC only knows about package databases containing units. It is a sad
    mismatch not fixed by this patch (we would have to rename parameters
    such as `package-id <unit-id>` which would affect users).
    
    This patch however fixes the following internal names:
    
    - Renames PackageConfig into UnitInfo.
    - Rename systemPackageConfig into globalPackageDatabase[Path]
    - Rename PkgConfXX into PkgDbXX
    - Rename pkgIdMap into unitIdMap
    - Rename ModuleToPkgDbAll into ModuleNameProvidersMap
    - Rename lookupPackage into lookupUnit
    - Add comments on DynFlags package related fields
    
    It also introduces a new `PackageDatabase` datatype instead of
    explicitly passing the following tuple: `(FilePath,[PackageConfig])`.
    
    The `pkgDatabase` field in `DynFlags` now contains the unit info for
    each unit of each package database exactly as they have been read from
    disk. Previously the command-line flag `-distrust-all-packages` would
    modify these unit info. Now this flag only affects the "dynamic"
    consolidated package state found in `pkgState` field. It makes sense
    because `initPackages` could be called first with this
    `distrust-all-packages` flag set and then again (using ghc-api) without
    and it should work (package databases are not read again from disk when
    `initPackages` is called the second time).
    
    Bump haddock submodule
    29c701c1