Cabal-1.24.2.0: A framework for packaging Haskell software

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

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
  - installedUnitId :: UnitId
  - compatPackageKey :: String
  - license :: License
  - copyright :: String
  - maintainer :: String
  - author :: String
  - stability :: String
  - homepage :: String
  - pkgUrl :: String
  - synopsis :: String
  - description :: String
  - category :: String
  - abiHash :: AbiHash
  - 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]
  - ccOptions :: [String]
  - ldOptions :: [String]
  - frameworkDirs :: [FilePath]
  - frameworks :: [String]
  - haddockInterfaces :: [FilePath]
  - haddockHTMLs :: [FilePath]
  - pkgRoot :: Maybe FilePath
  }
- installedComponentId :: InstalledPackageInfo -> ComponentId
- installedPackageId :: InstalledPackageInfo -> UnitId
- data OriginalModule = OriginalModule {
  - originalPackageId :: UnitId
  - originalModuleName :: ModuleName
  }
- data ExposedModule = ExposedModule {
  - exposedName :: ModuleName
  - exposedReexport :: Maybe OriginalModule
  }
- data ParseResult a
  - = ParseFailed PError
  - | ParseOk [PWarning] a
- data PError
  - = AmbiguousParse String LineNo
  - | NoParse String LineNo
  - | TabsError LineNo
  - | FromString String (Maybe LineNo)
- data PWarning
- emptyInstalledPackageInfo :: InstalledPackageInfo
- parseInstalledPackageInfo :: String -> ParseResult InstalledPackageInfo
- showInstalledPackageInfo :: InstalledPackageInfo -> String
- showInstalledPackageInfoField :: String -> Maybe (InstalledPackageInfo -> String)
- showSimpleInstalledPackageInfoField :: String -> Maybe (InstalledPackageInfo -> String)
- fieldsInstalledPackageInfo :: [FieldDescr InstalledPackageInfo]

# Documentation

data InstalledPackageInfo Source #

Constructors

InstalledPackageInfo |
Fields sourcePackageId :: PackageId installedUnitId :: UnitId compatPackageKey :: String license :: License copyright :: String maintainer :: String author :: String stability :: String homepage :: String pkgUrl :: String synopsis :: String description :: String category :: String abiHash :: AbiHash 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] ccOptions :: [String] ldOptions :: [String] frameworkDirs :: [FilePath] frameworks :: [String] haddockInterfaces :: [FilePath] haddockHTMLs :: [FilePath] pkgRoot :: Maybe FilePath

Instances

Eq InstalledPackageInfo # |
Methods (==) :: InstalledPackageInfo -> InstalledPackageInfo -> Bool # (/=) :: InstalledPackageInfo -> InstalledPackageInfo -> Bool #
Read InstalledPackageInfo # |
Methods readsPrec :: Int -> ReadS InstalledPackageInfo Source # readList :: ReadS [InstalledPackageInfo] Source # readPrec :: ReadPrec InstalledPackageInfo Source # readListPrec :: ReadPrec [InstalledPackageInfo] Source #
Show InstalledPackageInfo # |
Methods showsPrec :: Int -> InstalledPackageInfo -> ShowS Source # show :: InstalledPackageInfo -> String Source # showList :: [InstalledPackageInfo] -> ShowS Source #
Generic InstalledPackageInfo # |
Associated Types type Rep InstalledPackageInfo :: * -> * Source # Methods from :: InstalledPackageInfo -> Rep InstalledPackageInfo x Source # to :: Rep InstalledPackageInfo x -> InstalledPackageInfo Source #
Binary InstalledPackageInfo # |
Methods put :: InstalledPackageInfo -> Put Source # get :: Get InstalledPackageInfo Source # putList :: [InstalledPackageInfo] -> Put Source #
PackageInstalled InstalledPackageInfo # |
Methods installedDepends :: InstalledPackageInfo -> [UnitId] Source #
HasUnitId InstalledPackageInfo # |
Methods installedUnitId :: InstalledPackageInfo -> UnitId Source #
Package InstalledPackageInfo # |
Methods packageId :: InstalledPackageInfo -> PackageIdentifier Source #
type Rep InstalledPackageInfo # |
type Rep InstalledPackageInfo = D1 (MetaData "InstalledPackageInfo" "Distribution.InstalledPackageInfo" "Cabal-1.24.2.0" False) (C1 (MetaCons "InstalledPackageInfo" PrefixI True) ((:*:) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "sourcePackageId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PackageId)) (S1 (MetaSel (Just Symbol "installedUnitId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 UnitId))) ((:*:) (S1 (MetaSel (Just Symbol "compatPackageKey") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)) (S1 (MetaSel (Just Symbol "license") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 License)))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "copyright") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)) (S1 (MetaSel (Just Symbol "maintainer") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))) ((:*:) (S1 (MetaSel (Just Symbol "author") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)) (S1 (MetaSel (Just Symbol "stability") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "homepage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)) (S1 (MetaSel (Just Symbol "pkgUrl") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))) ((:*:) (S1 (MetaSel (Just Symbol "synopsis") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)) (S1 (MetaSel (Just Symbol "description") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "category") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)) (S1 (MetaSel (Just Symbol "abiHash") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 AbiHash))) ((:*:) (S1 (MetaSel (Just Symbol "exposed") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) ((:*:) (S1 (MetaSel (Just Symbol "exposedModules") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [ExposedModule])) (S1 (MetaSel (Just Symbol "hiddenModules") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [ModuleName]))))))) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "trusted") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) (S1 (MetaSel (Just Symbol "importDirs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath]))) ((:*:) (S1 (MetaSel (Just Symbol "libraryDirs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath])) (S1 (MetaSel (Just Symbol "libraryDynDirs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath])))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "dataDir") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 FilePath)) (S1 (MetaSel (Just Symbol "hsLibraries") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [String]))) ((:*:) (S1 (MetaSel (Just Symbol "extraLibraries") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [String])) ((:*:) (S1 (MetaSel (Just Symbol "extraGHCiLibraries") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [String])) (S1 (MetaSel (Just Symbol "includeDirs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath])))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "includes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [String])) (S1 (MetaSel (Just Symbol "depends") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [UnitId]))) ((:*:) (S1 (MetaSel (Just Symbol "ccOptions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [String])) (S1 (MetaSel (Just Symbol "ldOptions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [String])))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "frameworkDirs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath])) (S1 (MetaSel (Just Symbol "frameworks") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [String]))) ((:*:) (S1 (MetaSel (Just Symbol "haddockInterfaces") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath])) ((:*:) (S1 (MetaSel (Just Symbol "haddockHTMLs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath])) (S1 (MetaSel (Just Symbol "pkgRoot") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe FilePath))))))))))

installedComponentId :: InstalledPackageInfo -> ComponentId Source #

installedPackageId :: InstalledPackageInfo -> UnitId Source #

Deprecated: Use installedUnitId instead

Backwards compatibility with Cabal pre-1.24.

data OriginalModule Source #

Constructors

OriginalModule |
Fields originalPackageId :: UnitId originalModuleName :: ModuleName

Instances

Eq OriginalModule # |
Methods (==) :: OriginalModule -> OriginalModule -> Bool # (/=) :: OriginalModule -> OriginalModule -> Bool #
Read OriginalModule # |
Methods readsPrec :: Int -> ReadS OriginalModule Source # readList :: ReadS [OriginalModule] Source # readPrec :: ReadPrec OriginalModule Source # readListPrec :: ReadPrec [OriginalModule] Source #
Show OriginalModule # |
Methods showsPrec :: Int -> OriginalModule -> ShowS Source # show :: OriginalModule -> String Source # showList :: [OriginalModule] -> ShowS Source #
Generic OriginalModule # |
Associated Types type Rep OriginalModule :: * -> * Source # Methods from :: OriginalModule -> Rep OriginalModule x Source # to :: Rep OriginalModule x -> OriginalModule Source #
Binary OriginalModule # |
Methods put :: OriginalModule -> Put Source # get :: Get OriginalModule Source # putList :: [OriginalModule] -> Put Source #
Text OriginalModule # |
Methods disp :: OriginalModule -> Doc Source # parse :: ReadP r OriginalModule Source #
type Rep OriginalModule # |
type Rep OriginalModule = D1 (MetaData "OriginalModule" "Distribution.InstalledPackageInfo" "Cabal-1.24.2.0" False) (C1 (MetaCons "OriginalModule" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "originalPackageId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 UnitId)) (S1 (MetaSel (Just Symbol "originalModuleName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ModuleName))))

data ExposedModule Source #

Constructors

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

Instances

Eq ExposedModule # |
Methods (==) :: ExposedModule -> ExposedModule -> Bool # (/=) :: ExposedModule -> ExposedModule -> Bool #
Read ExposedModule # |
Methods readsPrec :: Int -> ReadS ExposedModule Source # readList :: ReadS [ExposedModule] Source # readPrec :: ReadPrec ExposedModule Source # readListPrec :: ReadPrec [ExposedModule] Source #
Show ExposedModule # |
Methods showsPrec :: Int -> ExposedModule -> ShowS Source # show :: ExposedModule -> String Source # showList :: [ExposedModule] -> ShowS Source #
Generic ExposedModule # |
Associated Types type Rep ExposedModule :: * -> * Source # Methods from :: ExposedModule -> Rep ExposedModule x Source # to :: Rep ExposedModule x -> ExposedModule Source #
Binary ExposedModule # |
Methods put :: ExposedModule -> Put Source # get :: Get ExposedModule Source # putList :: [ExposedModule] -> Put Source #
Text ExposedModule # |
Methods disp :: ExposedModule -> Doc Source # parse :: ReadP r ExposedModule Source #
type Rep ExposedModule # |
type Rep ExposedModule = D1 (MetaData "ExposedModule" "Distribution.InstalledPackageInfo" "Cabal-1.24.2.0" False) (C1 (MetaCons "ExposedModule" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "exposedName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ModuleName)) (S1 (MetaSel (Just Symbol "exposedReexport") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe OriginalModule)))))

data ParseResult a Source #

Constructors

ParseFailed PError |
ParseOk [PWarning] a |

Instances

Monad ParseResult # |
Methods (>>=) :: ParseResult a -> (a -> ParseResult b) -> ParseResult b Source # (>>) :: ParseResult a -> ParseResult b -> ParseResult b Source # return :: a -> ParseResult a Source # fail :: String -> ParseResult a Source #
Functor ParseResult # |
Methods fmap :: (a -> b) -> ParseResult a -> ParseResult b Source # (<$) :: a -> ParseResult b -> ParseResult a Source #
MonadFail ParseResult # |
Methods fail :: String -> ParseResult a Source #
Applicative ParseResult # |
Methods pure :: a -> ParseResult a Source # (<*>) :: ParseResult (a -> b) -> ParseResult a -> ParseResult b Source # (*>) :: ParseResult a -> ParseResult b -> ParseResult b Source # (<*) :: ParseResult a -> ParseResult b -> ParseResult a Source #
Show a => Show (ParseResult a) # |
Methods showsPrec :: Int -> ParseResult a -> ShowS Source # show :: ParseResult a -> String Source # showList :: [ParseResult a] -> ShowS Source #

data PError Source #

Constructors

AmbiguousParse String LineNo |
NoParse String LineNo |
TabsError LineNo |
FromString String (Maybe LineNo) |

Instances

Eq PError # |
Methods (==) :: PError -> PError -> Bool # (/=) :: PError -> PError -> Bool #
Show PError # |
Methods showsPrec :: Int -> PError -> ShowS Source # show :: PError -> String Source # showList :: [PError] -> ShowS Source #

data PWarning Source #

Instances

Eq PWarning # |
Methods (==) :: PWarning -> PWarning -> Bool # (/=) :: PWarning -> PWarning -> Bool #
Show PWarning # |
Methods showsPrec :: Int -> PWarning -> ShowS Source # show :: PWarning -> String Source # showList :: [PWarning] -> ShowS Source #

emptyInstalledPackageInfo :: InstalledPackageInfo Source #

parseInstalledPackageInfo :: String -> ParseResult InstalledPackageInfo Source #

showInstalledPackageInfo :: InstalledPackageInfo -> String Source #

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

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

fieldsInstalledPackageInfo :: [FieldDescr InstalledPackageInfo] Source #