ghc-6.12.3: The GHC APISource codeContentsIndex
Packages
Contents
The PackageConfigMap
Reading the package config, and processing cmdline args
Inspecting the set of packages in scope
Utils
Description
Package manipulation
Synopsis
module PackageConfig
type PackageConfigMap = UniqFM PackageConfig
emptyPackageConfigMap :: PackageConfigMap
lookupPackage :: PackageConfigMap -> PackageId -> Maybe PackageConfig
extendPackageConfigMap :: PackageConfigMap -> [PackageConfig] -> PackageConfigMap
dumpPackages :: DynFlags -> IO ()
data PackageState = PackageState {
pkgIdMap :: PackageConfigMap
preloadPackages :: [PackageId]
moduleToPkgConfAll :: UniqFM [(PackageConfig, Bool)]
installedPackageIdMap :: InstalledPackageIdMap
}
initPackages :: DynFlags -> IO (DynFlags, [PackageId])
getPackageDetails :: PackageState -> PackageId -> PackageConfig
lookupModuleInAllPackages :: DynFlags -> ModuleName -> [(PackageConfig, Bool)]
getPackageIncludePath :: DynFlags -> [PackageId] -> IO [String]
getPackageLibraryPath :: DynFlags -> [PackageId] -> IO [String]
getPackageLinkOpts :: DynFlags -> [PackageId] -> IO [String]
getPackageExtraCcOpts :: DynFlags -> [PackageId] -> IO [String]
getPackageFrameworkPath :: DynFlags -> [PackageId] -> IO [String]
getPackageFrameworks :: DynFlags -> [PackageId] -> IO [String]
getPreloadPackagesAnd :: DynFlags -> [PackageId] -> IO [PackageConfig]
collectIncludeDirs :: [PackageConfig] -> [FilePath]
collectLibraryPaths :: [PackageConfig] -> [FilePath]
collectLinkOpts :: DynFlags -> [PackageConfig] -> [String]
packageHsLibs :: DynFlags -> PackageConfig -> [String]
isDllName :: PackageId -> Name -> Bool
Documentation
module PackageConfig
The PackageConfigMap
type PackageConfigMap = UniqFM PackageConfigSource
A PackageConfigMap maps a PackageId to a PackageConfig
emptyPackageConfigMap :: PackageConfigMapSource
lookupPackage :: PackageConfigMap -> PackageId -> Maybe PackageConfigSource
Find the package we know about with the given id (e.g. "foo-1.0"), if any
extendPackageConfigMap :: PackageConfigMap -> [PackageConfig] -> PackageConfigMapSource
dumpPackages :: DynFlags -> IO ()Source
Show package info on console, if verbosity is >= 3
Reading the package config, and processing cmdline args
data PackageState Source

Package state is all stored in DynFlags, including the details of all packages, which packages are exposed, and which modules they provide.

The package state is computed by initPackages, and kept in DynFlags.

  • -package pkg>@ causes @<pkg to become exposed, and all other packages with the same name to become hidden.
  • -hide-package pkg>@ causes @<pkg to become hidden.
  • Let exposedPackages be the set of packages thus exposed. Let depExposedPackages be the transitive closure from exposedPackages of their dependencies.
  • When searching for a module from an preload import declaration, only the exposed modules in exposedPackages are valid.
  • When searching for a module from an implicit import, all modules from depExposedPackages are valid.
  • When linking in a compilation manager mode, we link in packages the program depends on (the compiler knows this list by the time it gets to the link step). Also, we link in all packages which were mentioned with preload -package flags on the command-line, or are a transitive dependency of same, or are "base"/"rts". The reason for this is that we might need packages which don't contain any Haskell modules, and therefore won't be discovered by the normal mechanism of dependency tracking.
Constructors
PackageState
pkgIdMap :: PackageConfigMap
preloadPackages :: [PackageId]
moduleToPkgConfAll :: UniqFM [(PackageConfig, Bool)]
installedPackageIdMap :: InstalledPackageIdMap
initPackages :: DynFlags -> IO (DynFlags, [PackageId])Source

Call this after DynFlags.parseDynFlags. It reads the package configuration files, and sets up various internal tables of package information, according to the package-related flags on the command-line (-package, -hide-package etc.)

Returns a list of packages to link in if we're doing dynamic linking. This list contains the packages that the user explicitly mentioned with -package flags.

initPackages can be called again subsequently after updating the packageFlags field of the DynFlags, and it will update the pkgState in DynFlags and return a list of packages to link in.

getPackageDetails :: PackageState -> PackageId -> PackageConfigSource
Looks up the package with the given id in the package state, panicing if it is not found
lookupModuleInAllPackages :: DynFlags -> ModuleName -> [(PackageConfig, Bool)]Source
Takes a Module, and if the module is in a package returns (pkgconf, exposed) where pkgconf is the PackageConfig for that package, and exposed is True if the package exposes the module.
Inspecting the set of packages in scope
getPackageIncludePath :: DynFlags -> [PackageId] -> IO [String]Source
Find all the include directories in these and the preload packages
getPackageLibraryPath :: DynFlags -> [PackageId] -> IO [String]Source
Find all the library paths in these and the preload packages
getPackageLinkOpts :: DynFlags -> [PackageId] -> IO [String]Source
Find all the link options in these and the preload packages
getPackageExtraCcOpts :: DynFlags -> [PackageId] -> IO [String]Source
Find all the C-compiler options in these and the preload packages
getPackageFrameworkPath :: DynFlags -> [PackageId] -> IO [String]Source
Find all the package framework paths in these and the preload packages
getPackageFrameworks :: DynFlags -> [PackageId] -> IO [String]Source
Find all the package frameworks in these and the preload packages
getPreloadPackagesAnd :: DynFlags -> [PackageId] -> IO [PackageConfig]Source
Find all the PackageConfig in both the preload packages from DynFlags and corresponding to the list of PackageConfigs
collectIncludeDirs :: [PackageConfig] -> [FilePath]Source
collectLibraryPaths :: [PackageConfig] -> [FilePath]Source
collectLinkOpts :: DynFlags -> [PackageConfig] -> [String]Source
packageHsLibs :: DynFlags -> PackageConfig -> [String]Source
Utils
isDllName :: PackageId -> Name -> BoolSource
Will the Name come from a dynamically linked library?
Produced by Haddock version 2.6.1