ghc-9.10.1: The GHC API
Safe HaskellNone
LanguageGHC2021

GHC.Unit.Info

Description

Info about installed units (compiled libraries)

Synopsis

Documentation

data GenericUnitInfo srcpkgid srcpkgname uid modulename mod Source #

Information about an unit (a unit is an installed module library).

This is a subset of Cabal's InstalledPackageInfo, with just the bits that GHC is interested in.

Some types are left as parameters to be instantiated differently in ghc-pkg and in ghc itself.

Constructors

GenericUnitInfo 

Fields

  • unitId :: uid

    Unique unit identifier that is used during compilation (e.g. to generate symbols).

  • unitInstanceOf :: uid

    Identifier of an indefinite unit (i.e. with module holes) that this unit is an instance of.

    For non instantiated units, unitInstanceOf=unitId

  • unitInstantiations :: [(modulename, mod)]

    How this unit instantiates some of its module holes. Map hole module names to actual module

  • unitPackageId :: srcpkgid

    Source package identifier.

    Cabal instantiates this with Distribution.Types.PackageId.PackageId type which only contains the source package name and version. Notice that it doesn't contain the Hackage revision, nor any kind of hash.

  • unitPackageName :: srcpkgname

    Source package name

  • unitPackageVersion :: Version

    Source package version

  • unitComponentName :: Maybe srcpkgname

    Name of the component.

    Cabal supports more than one components (libraries, executables, testsuites) in the same package. Each component has a name except the default one (that can only be a library component) for which we use Nothing.

    GHC only deals with "library" components as they are the only kind of components that can be registered in a database and used by other modules.

  • unitAbiHash :: ShortText

    ABI hash used to avoid mixing up units compiled with different dependencies, compiler, options, etc.

  • unitDepends :: [uid]

    Identifiers of the units this one depends on

  • unitAbiDepends :: [(uid, ShortText)]

    Like unitDepends, but each dependency is annotated with the ABI hash we expect the dependency to respect.

  • unitImportDirs :: [FilePathST]

    Directories containing module interfaces

  • unitLibraries :: [ShortText]

    Names of the Haskell libraries provided by this unit

  • unitExtDepLibsSys :: [ShortText]

    Names of the external system libraries that this unit depends on. See also unitExtDepLibsGhc field.

  • unitExtDepLibsGhc :: [ShortText]

    Because of slight differences between the GHC dynamic linker (in GHC.Runtime.Linker) and the native system linker, some packages have to link with a different list of libraries when using GHC's. Examples include: libs that are actually gnu ld scripts, and the possibility that the .a libs do not exactly match the .so/.dll equivalents.

    If this field is set, then we use that instead of the unitExtDepLibsSys field.

  • unitLibraryDirs :: [FilePathST]

    Directories containing libraries provided by this unit. See also unitLibraryDynDirs.

    It seems to be used to store paths to external library dependencies too.

  • unitLibraryDynDirs :: [FilePathST]

    Directories containing the dynamic libraries provided by this unit. See also unitLibraryDirs.

    It seems to be used to store paths to external dynamic library dependencies too.

  • unitExtDepFrameworks :: [ShortText]

    Names of the external MacOS frameworks that this unit depends on.

  • unitExtDepFrameworkDirs :: [FilePathST]

    Directories containing MacOS frameworks that this unit depends on.

  • unitLinkerOptions :: [ShortText]

    Linker (e.g. ld) command line options

  • unitCcOptions :: [ShortText]

    C compiler options that needs to be passed to the C compiler when we compile some C code against this unit.

  • unitIncludes :: [ShortText]

    C header files that are required by this unit (provided by this unit or external)

  • unitIncludeDirs :: [FilePathST]

    Directories containing C header files that this unit depends on.

  • unitHaddockInterfaces :: [FilePathST]

    Paths to Haddock interface files for this unit

  • unitHaddockHTMLs :: [FilePathST]

    Paths to Haddock directories containing HTML files

  • unitExposedModules :: [(modulename, Maybe mod)]

    Modules exposed by the unit.

    A module can be re-exported from another package. In this case, we indicate the module origin in the second parameter.

  • unitHiddenModules :: [modulename]

    Hidden modules.

    These are useful for error reporting (e.g. if a hidden module is imported)

  • unitIsIndefinite :: Bool

    True if this unit has some module holes that need to be instantiated with real modules to make the unit usable (a.k.a. Backpack).

  • unitIsExposed :: Bool

    True if the unit is exposed. A unit could be installed in a database by "disabled" by not being exposed.

  • unitIsTrusted :: Bool

    True if the unit is trusted (cf Safe Haskell)

Instances

Instances details
Binary DbUnitInfo 
Instance details

Defined in GHC.Unit.Database

(Show uid, Show modulename, Show mod, Show srcpkgid, Show srcpkgname) => Show (GenericUnitInfo srcpkgid srcpkgname uid modulename mod) 
Instance details

Defined in GHC.Unit.Database

Methods

showsPrec :: Int -> GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> ShowS #

show :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> String #

showList :: [GenericUnitInfo srcpkgid srcpkgname uid modulename mod] -> ShowS #

(Eq uid, Eq modulename, Eq mod, Eq srcpkgid, Eq srcpkgname) => Eq (GenericUnitInfo srcpkgid srcpkgname uid modulename mod) 
Instance details

Defined in GHC.Unit.Database

Methods

(==) :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Bool #

(/=) :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Bool #

type GenUnitInfo unit = GenericUnitInfo PackageId PackageName unit ModuleName (GenModule (GenUnit unit)) Source #

Information about an installed unit

We parameterize on the unit identifier: * UnitKey: identifier used in the database (cf UnitKeyInfo) * UnitId: identifier used to generate code (cf UnitInfo)

These two identifiers are different for wired-in packages. See Note [About units] in GHC.Unit

type UnitInfo = GenUnitInfo UnitId Source #

Information about an installed unit (units are identified by their internal UnitId)

newtype UnitKey Source #

A unit key in the database

Constructors

UnitKey FastString 

Instances

Instances details
IsUnitId UnitKey Source # 
Instance details

Defined in GHC.Unit.Types

type UnitKeyInfo = GenUnitInfo UnitKey Source #

Information about an installed unit (units are identified by their database UnitKey)

mkUnitKeyInfo :: DbUnitInfo -> UnitKeyInfo Source #

Convert a DbUnitInfo (read from a package database) into UnitKeyInfo

mapUnitInfo :: IsUnitId v => (u -> v) -> GenUnitInfo u -> GenUnitInfo v Source #

Map over the unit parameter

mkUnitPprInfo :: (u -> FastString) -> GenUnitInfo u -> UnitPprInfo Source #

Create a UnitPprInfo from a UnitInfo

mkUnit :: UnitInfo -> Unit Source #

Make a Unit from a UnitInfo

If the unit is definite, make a RealUnit from unitId field.

If the unit is indefinite, make a VirtUnit from unitInstanceOf and unitInstantiations fields. Note that in this case we don't keep track of unitId. It can be retrieved later with "improvement", i.e. matching on `unitInstanceOf/unitInstantiations` fields (see Note [About units] in GHC.Unit).

newtype PackageId Source #

Constructors

PackageId FastString 

Instances

Instances details
Uniquable PackageId Source # 
Instance details

Defined in GHC.Unit.Info

Outputable PackageId Source # 
Instance details

Defined in GHC.Unit.Info

Methods

ppr :: PackageId -> SDoc Source #

Eq PackageId Source # 
Instance details

Defined in GHC.Unit.Info

newtype PackageName Source #

Constructors

PackageName 

Instances

Instances details
Uniquable PackageName Source # 
Instance details

Defined in GHC.Unit.Info

Outputable PackageName Source # 
Instance details

Defined in GHC.Unit.Info

Methods

ppr :: PackageName -> SDoc Source #

Eq PackageName Source # 
Instance details

Defined in GHC.Unit.Info

data Version #

Constructors

Version 

Fields

Instances

Instances details
Binary Version

Since: binary-0.8.0.0

Instance details

Defined in Data.Binary.Class

NFData Version

Since: deepseq-1.3.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Version -> () Source #

Data Version 
Instance details

Defined in GHC.Internal.Data.Data

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Version -> c Version #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Version #

toConstr :: Version -> Constr #

dataTypeOf :: Version -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Version) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Version) #

gmapT :: (forall b. Data b => b -> b) -> Version -> Version #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Version -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Version -> r #

gmapQ :: (forall d. Data d => d -> u) -> Version -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Version -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Version -> m Version #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Version -> m Version #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Version -> m Version #

Generic Version 
Instance details

Defined in GHC.Internal.Data.Version

Associated Types

type Rep Version 
Instance details

Defined in GHC.Internal.Data.Version

type Rep Version = D1 ('MetaData "Version" "GHC.Internal.Data.Version" "ghc-internal" 'False) (C1 ('MetaCons "Version" 'PrefixI 'True) (S1 ('MetaSel ('Just "versionBranch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Int]) :*: S1 ('MetaSel ('Just "versionTags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String])))

Methods

from :: Version -> Rep Version x #

to :: Rep Version x -> Version #

IsList Version 
Instance details

Defined in GHC.Internal.IsList

Associated Types

type Item Version 
Instance details

Defined in GHC.Internal.IsList

Read Version 
Instance details

Defined in GHC.Internal.Data.Version

Show Version 
Instance details

Defined in GHC.Internal.Data.Version

Eq Version 
Instance details

Defined in GHC.Internal.Data.Version

Methods

(==) :: Version -> Version -> Bool #

(/=) :: Version -> Version -> Bool #

Ord Version 
Instance details

Defined in GHC.Internal.Data.Version

type Rep Version 
Instance details

Defined in GHC.Internal.Data.Version

type Rep Version = D1 ('MetaData "Version" "GHC.Internal.Data.Version" "ghc-internal" 'False) (C1 ('MetaCons "Version" 'PrefixI 'True) (S1 ('MetaSel ('Just "versionBranch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Int]) :*: S1 ('MetaSel ('Just "versionTags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String])))
type Item Version 
Instance details

Defined in GHC.Internal.IsList

collectIncludeDirs :: [UnitInfo] -> [FilePath] Source #

Find all the include directories in the given units

collectExtraCcOpts :: [UnitInfo] -> [String] Source #

Find all the C-compiler options in the given units

collectLibraryDirs :: Ways -> [UnitInfo] -> [FilePath] Source #

Find all the library directories in the given units for the given ways

collectFrameworks :: [UnitInfo] -> [String] Source #

Find all the frameworks in the given units

collectFrameworksDirs :: [UnitInfo] -> [String] Source #

Find all the package framework paths in these and the preload packages