Safe Haskell | None |
---|---|
Language | GHC2021 |
Like
but for the Graph
which is
stored in the EPS.ExternalModuleGraph
Synopsis
- data ExternalModuleGraph
- data ExternalGraphNode
- data ExternalKey
- emptyExternalModuleGraph :: ExternalModuleGraph
- emgNodeKey :: ExternalGraphNode -> ExternalKey
- emgNodeDeps :: Bool -> ExternalGraphNode -> [ExternalKey]
- emgLookupKey :: ExternalKey -> ExternalModuleGraph -> Maybe ExternalGraphNode
- extendExternalModuleGraph :: ExternalGraphNode -> ExternalModuleGraph -> ExternalModuleGraph
- isFullyLoadedModule :: ExternalKey -> ExternalModuleGraph -> Bool
- setFullyLoadedModule :: ExternalKey -> ExternalModuleGraph -> ExternalModuleGraph
- emgReachableLoop :: ExternalModuleGraph -> ExternalKey -> Maybe [ExternalGraphNode]
- emgReachableLoopMany :: ExternalModuleGraph -> [ExternalKey] -> [ExternalGraphNode]
External Module Graph
A module graph for the EPS.
data ExternalModuleGraph Source #
Instances
Outputable ExternalModuleGraph Source # | |
Defined in GHC.Unit.Module.External.Graph ppr :: ExternalModuleGraph -> SDoc Source # |
data ExternalGraphNode Source #
NodeHomePackage | A node for a home package module that is inserted in the EPS. INVARIANT: This type of node can only ever exist if compiling in one-shot mode. In --make mode, it is imperative that the EPS doesn't have any home package modules ever. |
NodeExternalPackage | A node for packages with at least one module loaded in the EPS. Edge from A to NodeExternalPackage p when A has p as a direct package dependency. |
Instances
Outputable ExternalGraphNode Source # | |
Defined in GHC.Unit.Module.External.Graph ppr :: ExternalGraphNode -> SDoc Source # |
data ExternalKey Source #
Instances
Outputable ExternalKey Source # | |
Defined in GHC.Unit.Module.External.Graph ppr :: ExternalKey -> SDoc Source # | |
Eq ExternalKey Source # | |
Defined in GHC.Unit.Module.External.Graph (==) :: ExternalKey -> ExternalKey -> Bool # (/=) :: ExternalKey -> ExternalKey -> Bool # | |
Ord ExternalKey Source # | |
Defined in GHC.Unit.Module.External.Graph compare :: ExternalKey -> ExternalKey -> Ordering # (<) :: ExternalKey -> ExternalKey -> Bool # (<=) :: ExternalKey -> ExternalKey -> Bool # (>) :: ExternalKey -> ExternalKey -> Bool # (>=) :: ExternalKey -> ExternalKey -> Bool # max :: ExternalKey -> ExternalKey -> ExternalKey # min :: ExternalKey -> ExternalKey -> ExternalKey # |
emgNodeKey :: ExternalGraphNode -> ExternalKey Source #
The graph key for a given node
emgNodeDeps :: Bool -> ExternalGraphNode -> [ExternalKey] Source #
Get the dependencies of an ExternalNode
emgLookupKey :: ExternalKey -> ExternalModuleGraph -> Maybe ExternalGraphNode Source #
Lookup a key in the EMG.
Extending
The
is a structure which is incrementally
updated as the ExternalModuleGraph
ExternalPackageState
(EPS) is updated (when an iface is
loaded, in loadInterface
).
Therefore, there is an operation for extending the ExternalModuleGraph
,
unlike
, which is constructed once
during downsweep and never altered (since all of the home units
dependencies are fully known then).ModuleGraph
extendExternalModuleGraph :: ExternalGraphNode -> ExternalModuleGraph -> ExternalModuleGraph Source #
Loading
As mentioned in the top-level haddocks for the
extendExternalModuleGraph
, the external module graph is incrementally
updated as interfaces are loaded. This module graph keeps an additional
cache registering which modules have already been fully loaded.
This cache is necessary to quickly check when a full-transitive-closure reachability query would be valid for some module.
Such a query may be invalid if ran on a module in the
ExternalModuleGraph
whose dependencies have not yet been fully loaded
into the EPS.
(Recall that interfaces are lazily loaded, and the ExternalModuleGraph
is only incrementally updated).
To guarantee the full transitive closure of a given module is completely
loaded into the EPS (i.e. all interfaces of the modules below this one
are also loaded), see
in
loadExternalGraphBelow
Load
.
Reachability
Fast reachability queries on the external module graph. Similar to
reachability queries on Graph
.
emgReachableLoop :: ExternalModuleGraph -> ExternalKey -> Maybe [ExternalGraphNode] Source #
Return all nodes reachable from the given key, also known as its full transitive closure.
Nothing
if the key couldn't be found in the graph.
emgReachableLoopMany :: ExternalModuleGraph -> [ExternalKey] -> [ExternalGraphNode] Source #
Return all nodes reachable from all of the given keys.