Safe Haskell | None |
---|
Package manipulation
- 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)]
- lookupModuleWithSuggestions :: DynFlags -> ModuleName -> Either [Module] [(PackageConfig, Bool)]
- getPackageIncludePath :: DynFlags -> [PackageId] -> IO [String]
- getPackageLibraryPath :: DynFlags -> [PackageId] -> IO [String]
- getPackageLinkOpts :: DynFlags -> [PackageId] -> IO ([String], [String], [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], [String], [String])
- packageHsLibs :: DynFlags -> PackageConfig -> [String]
- isDllName :: DynFlags -> PackageId -> Module -> Name -> Bool
Documentation
module PackageConfig
The PackageConfigMap
type PackageConfigMap = UniqFM PackageConfigSource
A PackageConfigMap maps a PackageId
to a PackageConfig
lookupPackage :: PackageConfigMap -> PackageId -> Maybe PackageConfigSource
Find the package we know about with the given id (e.g. "foo-1.0"), if any
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
causespkg
to become exposed, and all other packages with the same name to become hidden. -
-hide-package pkg
causespkg
to become hidden. - Let
exposedPackages
be the set of packages thus exposed. LetdepExposedPackages
be the transitive closure fromexposedPackages
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.
PackageState | |
|
initPackages :: DynFlags -> IO (DynFlags, [PackageId])Source
Call this after parseDynFlags
. It reads the package
database 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.
lookupModuleWithSuggestions :: DynFlags -> ModuleName -> Either [Module] [(PackageConfig, Bool)]Source
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], [String], [String])Source
Find all the link options in these and the preload packages, returning (package hs lib options, extra library options, other flags)
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
PackageConfig
s
collectIncludeDirs :: [PackageConfig] -> [FilePath]Source
collectLibraryPaths :: [PackageConfig] -> [FilePath]Source
collectLinkOpts :: DynFlags -> [PackageConfig] -> ([String], [String], [String])Source
packageHsLibs :: DynFlags -> PackageConfig -> [String]Source