• Sylvain Henry's avatar
    Refactoring unit management code · 10d15f1e
    Sylvain Henry authored
    Over the years the unit management code has been modified a lot to keep
    up with changes in Cabal (e.g. support for several library components in
    the same package), to integrate BackPack, etc. I found it very hard to
    understand as the terminology wasn't consistent, was referring to past
    concepts, etc.
    
    The terminology is now explained as clearly as I could in the Note
    "About Units" and the code is refactored to reflect it.
    
    -------------------
    
    Many names were misleading: UnitId is not an Id but could be a virtual
    unit (an indefinite one instantiated on the fly), IndefUnitId
    constructor may contain a definite instantiated unit, etc.
    
       * Rename IndefUnitId into InstantiatedUnit
       * Rename IndefModule into InstantiatedModule
       * Rename UnitId type into Unit
       * Rename IndefiniteUnitId constructor into VirtUnit
       * Rename DefiniteUnitId constructor into RealUnit
       * Rename packageConfigId into mkUnit
       * Rename getPackageDetails into unsafeGetUnitInfo
       * Rename InstalledUnitId into UnitId
    
    Remove references to misleading ComponentId: a ComponentId is just an
    indefinite unit-id to be instantiated.
    
       * Rename ComponentId into IndefUnitId
       * Rename ComponentDetails into UnitPprInfo
       * Fix display of UnitPprInfo with empty version: this is now used for
         units dynamically generated by BackPack
    
    Generalize several types (Module, Unit, etc.) so that they can be used
    with different unit identifier types: UnitKey, UnitId, Unit, etc.
    
       * GenModule: Module, InstantiatedModule and InstalledModule are now
         instances of this type
       * Generalize DefUnitId, IndefUnitId, Unit, InstantiatedUnit,
         PackageDatabase
    
    Replace BackPack fake "hole" UnitId by a proper HoleUnit constructor.
    
    Add basic support for UnitKey. They should be used more in the future to
    avoid mixing them up with UnitId as we do now.
    
    Add many comments.
    
    Update Haddock submodule
    10d15f1e
Code owners : Ömer Sinan Ağacan and Simon Marlow
Parser.y 55.5 KB