Distribution.InstalledPackageInfo

Cabal-3.5.0.0: A framework for packaging Haskell software

Copyright | (c) The University of Glasgow 2004
Maintainer | libraries@haskell.org
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Distribution.InstalledPackageInfo

Description

This is the information about an installed package that is communicated to the `ghc-pkg` program in order to register a package. `ghc-pkg` now consumes this package format (as of version 6.4). This is specific to GHC at the moment.

The `.cabal` file format is for describing a package that is not yet installed. It has a lot of flexibility, like conditionals and dependency ranges. As such, that format is not at all suitable for describing a package that has already been built and installed. By the time we get to that stage, we have resolved all conditionals and resolved dependency version constraints to exact versions of dependent packages. So, this module defines the `InstalledPackageInfo` data structure that contains all the info we keep about an installed package. There is a parser and pretty printer. The textual format is rather simpler than the `.cabal` format: there are no sections, for example.

Synopsis

- data InstalledPackageInfo = InstalledPackageInfo {
  - sourcePackageId :: PackageId
  - sourceLibName :: LibraryName
  - installedComponentId_ :: ComponentId
  - libVisibility :: LibraryVisibility
  - installedUnitId :: UnitId
  - instantiatedWith :: [(ModuleName, OpenModule)]
  - compatPackageKey :: String
  - license :: Either License License
  - copyright :: !ShortText
  - maintainer :: !ShortText
  - author :: !ShortText
  - stability :: !ShortText
  - homepage :: !ShortText
  - pkgUrl :: !ShortText
  - synopsis :: !ShortText
  - description :: !ShortText
  - category :: !ShortText
  - abiHash :: AbiHash
  - indefinite :: Bool
  - exposed :: Bool
  - exposedModules :: [ExposedModule]
  - hiddenModules :: [ModuleName]
  - trusted :: Bool
  - importDirs :: [FilePath]
  - libraryDirs :: [FilePath]
  - libraryDynDirs :: [FilePath]
  - dataDir :: FilePath
  - hsLibraries :: [String]
  - extraLibraries :: [String]
  - extraGHCiLibraries :: [String]
  - includeDirs :: [FilePath]
  - includes :: [String]
  - depends :: [UnitId]
  - abiDepends :: [AbiDependency]
  - ccOptions :: [String]
  - cxxOptions :: [String]
  - ldOptions :: [String]
  - frameworkDirs :: [FilePath]
  - frameworks :: [String]
  - haddockInterfaces :: [FilePath]
  - haddockHTMLs :: [FilePath]
  - pkgRoot :: Maybe FilePath
  }
- installedComponentId :: InstalledPackageInfo -> ComponentId
- installedOpenUnitId :: InstalledPackageInfo -> OpenUnitId
- sourceComponentName :: InstalledPackageInfo -> ComponentName
- requiredSignatures :: InstalledPackageInfo -> Set ModuleName
- data ExposedModule = ExposedModule {
  - exposedName :: ModuleName
  - exposedReexport :: Maybe OpenModule
  }
- data AbiDependency = AbiDependency {
  - depUnitId :: UnitId
  - depAbiHash :: AbiHash
  }
- emptyInstalledPackageInfo :: InstalledPackageInfo
- parseInstalledPackageInfo :: ByteString -> Either (NonEmpty String) ([String], InstalledPackageInfo)
- showInstalledPackageInfo :: InstalledPackageInfo -> String
- showFullInstalledPackageInfo :: InstalledPackageInfo -> String
- showInstalledPackageInfoField :: String -> Maybe (InstalledPackageInfo -> String)
- showSimpleInstalledPackageInfoField :: String -> Maybe (InstalledPackageInfo -> String)

# Documentation

data InstalledPackageInfo Source #

Constructors

InstalledPackageInfo |
Fields sourcePackageId :: PackageId sourceLibName :: LibraryName installedComponentId_ :: ComponentId libVisibility :: LibraryVisibility installedUnitId :: UnitId instantiatedWith :: [(ModuleName, OpenModule)] compatPackageKey :: String license :: Either License License copyright :: !ShortText maintainer :: !ShortText author :: !ShortText stability :: !ShortText homepage :: !ShortText pkgUrl :: !ShortText synopsis :: !ShortText description :: !ShortText category :: !ShortText abiHash :: AbiHash indefinite :: Bool exposed :: Bool exposedModules :: [ExposedModule] hiddenModules :: [ModuleName] trusted :: Bool importDirs :: [FilePath] libraryDirs :: [FilePath] libraryDynDirs :: [FilePath] overrides `libraryDirs` dataDir :: FilePath hsLibraries :: [String] extraLibraries :: [String] extraGHCiLibraries :: [String] includeDirs :: [FilePath] includes :: [String] depends :: [UnitId] abiDepends :: [AbiDependency] ccOptions :: [String] cxxOptions :: [String] ldOptions :: [String] frameworkDirs :: [FilePath] frameworks :: [String] haddockInterfaces :: [FilePath] haddockHTMLs :: [FilePath] pkgRoot :: Maybe FilePath

#### Instances

Instances details

IsNode InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Associated Types type Key InstalledPackageInfo Source # Methods nodeKey :: InstalledPackageInfo -> Key InstalledPackageInfo Source # nodeNeighbors :: InstalledPackageInfo -> [Key InstalledPackageInfo] Source #
HasMungedPackageId InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Methods mungedId :: InstalledPackageInfo -> MungedPackageId Source #
HasUnitId InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Methods installedUnitId :: InstalledPackageInfo -> UnitId Source #
Package InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Methods packageId :: InstalledPackageInfo -> PackageIdentifier Source #
PackageInstalled InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Methods installedDepends :: InstalledPackageInfo -> [UnitId] Source #
Structured InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Methods structure :: Proxy InstalledPackageInfo -> Structure Source # structureHash' :: Tagged InstalledPackageInfo MD5
Generic InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Associated Types type Rep InstalledPackageInfo :: Type -> Type Source # Methods from :: InstalledPackageInfo -> Rep InstalledPackageInfo x Source # to :: Rep InstalledPackageInfo x -> InstalledPackageInfo Source #
Read InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Methods readsPrec :: Int -> ReadS InstalledPackageInfo Source # readList :: ReadS [InstalledPackageInfo] Source # readPrec :: ReadPrec InstalledPackageInfo Source # readListPrec :: ReadPrec [InstalledPackageInfo] Source #
Show InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Methods showsPrec :: Int -> InstalledPackageInfo -> ShowS Source # show :: InstalledPackageInfo -> String Source # showList :: [InstalledPackageInfo] -> ShowS Source #
Binary InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Methods put :: InstalledPackageInfo -> Put Source # get :: Get InstalledPackageInfo Source # putList :: [InstalledPackageInfo] -> Put Source #
NFData InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Methods rnf :: InstalledPackageInfo -> () Source #
Eq InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo Methods (==) :: InstalledPackageInfo -> InstalledPackageInfo -> Bool # (/=) :: InstalledPackageInfo -> InstalledPackageInfo -> Bool #
Monoid (PackageIndex InstalledPackageInfo) # |
Instance details Defined in Distribution.Simple.PackageIndex Methods mempty :: PackageIndex InstalledPackageInfo Source # mappend :: PackageIndex InstalledPackageInfo -> PackageIndex InstalledPackageInfo -> PackageIndex InstalledPackageInfo Source # mconcat :: [PackageIndex InstalledPackageInfo] -> PackageIndex InstalledPackageInfo Source #
Semigroup (PackageIndex InstalledPackageInfo) # |
Instance details Defined in Distribution.Simple.PackageIndex Methods (<>) :: PackageIndex InstalledPackageInfo -> PackageIndex InstalledPackageInfo -> PackageIndex InstalledPackageInfo Source # sconcat :: NonEmpty (PackageIndex InstalledPackageInfo) -> PackageIndex InstalledPackageInfo Source # stimes :: Integral b => b -> PackageIndex InstalledPackageInfo -> PackageIndex InstalledPackageInfo Source #
type Key InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo type Key InstalledPackageInfo = UnitId
type Rep InstalledPackageInfo # |
Instance details Defined in Distribution.Types.InstalledPackageInfo type Rep InstalledPackageInfo = D1 ('MetaData "InstalledPackageInfo" "Distribution.Types.InstalledPackageInfo" "Cabal-3.5.0.0" 'False) (C1 ('MetaCons "InstalledPackageInfo" 'PrefixI 'True) (((((S1 ('MetaSel ('Just "sourcePackageId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageId) :*: S1 ('MetaSel ('Just "sourceLibName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LibraryName)) :*: (S1 ('MetaSel ('Just "installedComponentId_") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ComponentId) :*: (S1 ('MetaSel ('Just "libVisibility") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LibraryVisibility) :*: S1 ('MetaSel ('Just "installedUnitId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnitId)))) :*: ((S1 ('MetaSel ('Just "instantiatedWith") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(ModuleName, OpenModule)]) :*: S1 ('MetaSel ('Just "compatPackageKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "license") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Either License License)) :*: (S1 ('MetaSel ('Just "copyright") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ShortText) :*: S1 ('MetaSel ('Just "maintainer") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ShortText))))) :*: (((S1 ('MetaSel ('Just "author") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ShortText) :*: S1 ('MetaSel ('Just "stability") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ShortText)) :*: (S1 ('MetaSel ('Just "homepage") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ShortText) :*: (S1 ('MetaSel ('Just "pkgUrl") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ShortText) :*: S1 ('MetaSel ('Just "synopsis") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ShortText)))) :*: ((S1 ('MetaSel ('Just "description") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ShortText) :*: (S1 ('MetaSel ('Just "category") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ShortText) :*: S1 ('MetaSel ('Just "abiHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AbiHash))) :*: (S1 ('MetaSel ('Just "indefinite") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "exposed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "exposedModules") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ExposedModule])))))) :*: ((((S1 ('MetaSel ('Just "hiddenModules") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ModuleName]) :*: S1 ('MetaSel ('Just "trusted") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "importDirs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]) :*: (S1 ('MetaSel ('Just "libraryDirs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]) :*: S1 ('MetaSel ('Just "libraryDynDirs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath])))) :*: ((S1 ('MetaSel ('Just "dataDir") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: S1 ('MetaSel ('Just "hsLibraries") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String])) :*: (S1 ('MetaSel ('Just "extraLibraries") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: (S1 ('MetaSel ('Just "extraGHCiLibraries") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just "includeDirs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]))))) :*: (((S1 ('MetaSel ('Just "includes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just "depends") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [UnitId])) :*: (S1 ('MetaSel ('Just "abiDepends") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [AbiDependency]) :*: (S1 ('MetaSel ('Just "ccOptions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just "cxxOptions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String])))) :*: ((S1 ('MetaSel ('Just "ldOptions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: (S1 ('MetaSel ('Just "frameworkDirs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]) :*: S1 ('MetaSel ('Just "frameworks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]))) :*: (S1 ('MetaSel ('Just "haddockInterfaces") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]) :*: (S1 ('MetaSel ('Just "haddockHTMLs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]) :*: S1 ('MetaSel ('Just "pkgRoot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe FilePath)))))))))

installedComponentId :: InstalledPackageInfo -> ComponentId Source #

installedOpenUnitId :: InstalledPackageInfo -> OpenUnitId Source #

Get the indefinite unit identity representing this package. This IS NOT guaranteed to give you a substitution; for instantiated packages you will get `DefiniteUnitId (installedUnitId ipi)`. For indefinite libraries, however, you will correctly get an `OpenUnitId` with the appropriate `OpenModuleSubst`.

sourceComponentName :: InstalledPackageInfo -> ComponentName Source #

requiredSignatures :: InstalledPackageInfo -> Set ModuleName Source #

Returns the set of module names which need to be filled for an indefinite package, or the empty set if the package is definite.

data ExposedModule Source #

Constructors

ExposedModule |
Fields exposedName :: ModuleName exposedReexport :: Maybe OpenModule

#### Instances

Instances details

Parsec ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule Methods parsec :: CabalParsing m => m ExposedModule Source #
Pretty ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule Methods pretty :: ExposedModule -> Doc Source # prettyVersioned :: CabalSpecVersion -> ExposedModule -> Doc Source #
Structured ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule Methods structure :: Proxy ExposedModule -> Structure Source # structureHash' :: Tagged ExposedModule MD5
Generic ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule Associated Types type Rep ExposedModule :: Type -> Type Source # Methods from :: ExposedModule -> Rep ExposedModule x Source # to :: Rep ExposedModule x -> ExposedModule Source #
Read ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule Methods readsPrec :: Int -> ReadS ExposedModule Source # readList :: ReadS [ExposedModule] Source # readPrec :: ReadPrec ExposedModule Source # readListPrec :: ReadPrec [ExposedModule] Source #
Show ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule Methods showsPrec :: Int -> ExposedModule -> ShowS Source # show :: ExposedModule -> String Source # showList :: [ExposedModule] -> ShowS Source #
Binary ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule Methods put :: ExposedModule -> Put Source # get :: Get ExposedModule Source # putList :: [ExposedModule] -> Put Source #
NFData ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule Methods rnf :: ExposedModule -> () Source #
Eq ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule Methods (==) :: ExposedModule -> ExposedModule -> Bool # (/=) :: ExposedModule -> ExposedModule -> Bool #
type Rep ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule type Rep ExposedModule = D1 ('MetaData "ExposedModule" "Distribution.Types.ExposedModule" "Cabal-3.5.0.0" 'False) (C1 ('MetaCons "ExposedModule" 'PrefixI 'True) (S1 ('MetaSel ('Just "exposedName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ModuleName) :*: S1 ('MetaSel ('Just "exposedReexport") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe OpenModule))))

data AbiDependency Source #

An ABI dependency is a dependency on a library which also records the ABI hash (`abiHash`) of the library it depends on.

The primary utility of this is to enable an extra sanity when GHC loads libraries: it can check if the dependency has a matching ABI and if not, refuse to load this library. This information is critical if we are shadowing libraries; differences in the ABI hash let us know what packages get shadowed by the new version of a package.

Constructors

AbiDependency |
Fields depUnitId :: UnitId depAbiHash :: AbiHash

#### Instances

Instances details

Parsec AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency Methods parsec :: CabalParsing m => m AbiDependency Source #
Pretty AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency Methods pretty :: AbiDependency -> Doc Source # prettyVersioned :: CabalSpecVersion -> AbiDependency -> Doc Source #
Structured AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency Methods structure :: Proxy AbiDependency -> Structure Source # structureHash' :: Tagged AbiDependency MD5
Generic AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency Associated Types type Rep AbiDependency :: Type -> Type Source # Methods from :: AbiDependency -> Rep AbiDependency x Source # to :: Rep AbiDependency x -> AbiDependency Source #
Read AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency Methods readsPrec :: Int -> ReadS AbiDependency Source # readList :: ReadS [AbiDependency] Source # readPrec :: ReadPrec AbiDependency Source # readListPrec :: ReadPrec [AbiDependency] Source #
Show AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency Methods showsPrec :: Int -> AbiDependency -> ShowS Source # show :: AbiDependency -> String Source # showList :: [AbiDependency] -> ShowS Source #
Binary AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency Methods put :: AbiDependency -> Put Source # get :: Get AbiDependency Source # putList :: [AbiDependency] -> Put Source #
NFData AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency Methods rnf :: AbiDependency -> () Source #
Eq AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency Methods (==) :: AbiDependency -> AbiDependency -> Bool # (/=) :: AbiDependency -> AbiDependency -> Bool #
type Rep AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency type Rep AbiDependency = D1 ('MetaData "AbiDependency" "Distribution.Types.AbiDependency" "Cabal-3.5.0.0" 'False) (C1 ('MetaCons "AbiDependency" 'PrefixI 'True) (S1 ('MetaSel ('Just "depUnitId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnitId) :*: S1 ('MetaSel ('Just "depAbiHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AbiHash)))

emptyInstalledPackageInfo :: InstalledPackageInfo Source #

parseInstalledPackageInfo :: ByteString -> Either (NonEmpty String) ([String], InstalledPackageInfo) Source #

Return either errors, or IPI with list of warnings

showInstalledPackageInfo :: InstalledPackageInfo -> String Source #

Pretty print `InstalledPackageInfo`.

`pkgRoot` isn't printed, as ghc-pkg prints it manually (as GHC-8.4).

showFullInstalledPackageInfo :: InstalledPackageInfo -> String Source #

The variant of `showInstalledPackageInfo` which outputs `pkgroot` field too.

showInstalledPackageInfoField :: String -> Maybe (InstalledPackageInfo -> String) Source #

    >>> let ipi = emptyInstalledPackageInfo { maintainer = "Tester" }
    >>> fmap ($ ipi) $ showInstalledPackageInfoField "maintainer"
    Just "maintainer: Tester"

showSimpleInstalledPackageInfoField :: String -> Maybe (InstalledPackageInfo -> String) Source #