ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Unit.Module.Graph

Contents

- Construct a module graph
- Invariant checking
- Nodes in a module graph
- Module graph operations
  - `ModSummary` operations
  - Reachability queries
  - Other operations
- Keys into the `ModuleGraph`
  - Internal node representation

Description

A module graph should be constructed once and never change from there onwards.

The only operations should be for building the `ModuleGraph` (once and for all -- no update-like/insert-like functions) and querying the structure in various ways, e.g. to determine reachability.

We should avoid exposing fields like `mg_mss` since it may be a footgun trying to use the nodes directly... We do still expose it, but it feels like all its use cases would be better served by a more proper ModuleGraph abstraction

Synopsis

- data ModuleGraph = ModuleGraph {
  - mg_mss :: [ModuleGraphNode]
  - mg_graph :: (ReachabilityIndex SummaryNode, NodeKey -> Maybe SummaryNode)
  - mg_loop_graph :: (ReachabilityIndex SummaryNode, NodeKey -> Maybe SummaryNode)
  - mg_zero_graph :: (ReachabilityIndex ZeroSummaryNode, ZeroScopeKey -> Maybe ZeroSummaryNode)
  - mg_has_holes :: !Bool
  }
- emptyMG :: ModuleGraph
- mkModuleGraph :: [ModuleGraphNode] -> ModuleGraph
- mkModuleGraphChecked :: [ModuleGraphNode] -> Either [ModuleGraphInvariantError] ModuleGraph
- checkModuleGraph :: ModuleGraph -> [ModuleGraphInvariantError]
- data ModuleGraphInvariantError
  - = FixedNodeDependsOnCompileNode ModNodeKeyWithUid [NodeKey]
  - | DuplicateModuleNodeKey NodeKey
  - | DependencyNotInGraph NodeKey [NodeKey]
- data ModuleGraphNode
  - = InstantiationNode UnitId InstantiatedUnit
  - | ModuleNode [ModuleNodeEdge] ModuleNodeInfo
  - | LinkNode [NodeKey] UnitId
  - | UnitNode [UnitId] UnitId
- mgNodeDependencies :: Bool -> ModuleGraphNode -> [NodeKey]
- mgNodeIsModule :: ModuleGraphNode -> Maybe ModuleNodeInfo
- mgNodeUnitId :: ModuleGraphNode -> UnitId
- data ModuleNodeEdge = ModuleNodeEdge {
  - edgeLevel :: ImportLevel
  - edgeTargetKey :: NodeKey
  }
- mkModuleEdge :: ImportLevel -> NodeKey -> ModuleNodeEdge
- mkNormalEdge :: NodeKey -> ModuleNodeEdge
- data ModuleNodeInfo
  - = ModuleNodeFixed ModNodeKeyWithUid ModLocation
  - | ModuleNodeCompile ModSummary
- moduleNodeInfoModule :: ModuleNodeInfo -> Module
- moduleNodeInfoUnitId :: ModuleNodeInfo -> UnitId
- moduleNodeInfoMnwib :: ModuleNodeInfo -> ModuleNameWithIsBoot
- moduleNodeInfoModuleName :: ModuleNodeInfo -> ModuleName
- moduleNodeInfoModNodeKeyWithUid :: ModuleNodeInfo -> ModNodeKeyWithUid
- moduleNodeInfoHscSource :: ModuleNodeInfo -> Maybe HscSource
- moduleNodeInfoLocation :: ModuleNodeInfo -> ModLocation
- isBootModuleNodeInfo :: ModuleNodeInfo -> IsBootInterface
- lengthMG :: ModuleGraph -> Int
- isEmptyMG :: ModuleGraph -> Bool
- mapMG :: (ModSummary -> ModSummary) -> ModuleGraph -> ModuleGraph
- mgMapM :: (ModuleNodeInfo -> IO ModuleNodeInfo) -> ModuleGraph -> IO ModuleGraph
- mgModSummaries :: ModuleGraph -> [ModSummary]
- mgLookupModule :: ModuleGraph -> Module -> Maybe ModuleNodeInfo
- mgLookupModuleName :: ModuleGraph -> ModuleNameWithIsBoot -> [ModuleNodeInfo]
- mgHasHoles :: ModuleGraph -> Bool
- showModMsg :: DynFlags -> Bool -> ModuleGraphNode -> SDoc
- mgReachable :: ModuleGraph -> NodeKey -> Maybe [ModuleGraphNode]
- mgReachableLoop :: ModuleGraph -> [NodeKey] -> [ModuleGraphNode]
- mgQuery :: ModuleGraph -> NodeKey -> NodeKey -> Bool
- data ZeroScopeKey
  - = ModuleScope ModNodeKeyWithUid ImportLevel
  - | UnitScope UnitId
- mgQueryZero :: ModuleGraph -> ZeroScopeKey -> ZeroScopeKey -> Bool
- mgQueryMany :: ModuleGraph -> [NodeKey] -> NodeKey -> Bool
- mgQueryManyZero :: ModuleGraph -> [ZeroScopeKey] -> ZeroScopeKey -> Bool
- mgMember :: ModuleGraph -> NodeKey -> Bool
- mgModSummaries' :: ModuleGraph -> [ModuleGraphNode]
- moduleGraphNodes :: Bool -> [ModuleGraphNode] -> (Graph SummaryNode, NodeKey -> Maybe SummaryNode)
- moduleGraphModulesBelow :: ModuleGraph -> UnitId -> ModuleNameWithIsBoot -> Set ModNodeKeyWithUid
- filterToposortToModules :: [SCC ModuleGraphNode] -> [SCC ModuleNodeInfo]
- moduleGraphNodesZero :: [ModuleGraphNode] -> (Graph ZeroSummaryNode, ZeroScopeKey -> Maybe ZeroSummaryNode)
- type StageSummaryNode = Node Int (NodeKey, ModuleStage)
- stageSummaryNodeSummary :: StageSummaryNode -> (NodeKey, ModuleStage)
- stageSummaryNodeKey :: StageSummaryNode -> Int
- mkStageDeps :: [ModuleGraphNode] -> (ReachabilityIndex StageSummaryNode, (NodeKey, ModuleStage) -> Maybe StageSummaryNode)
- data NodeKey
  - = NodeKey_Unit !InstantiatedUnit
  - | NodeKey_Module !ModNodeKeyWithUid
  - | NodeKey_Link !UnitId
  - | NodeKey_ExternalUnit !UnitId
- mkNodeKey :: ModuleGraphNode -> NodeKey
- nodeKeyUnitId :: NodeKey -> UnitId
- nodeKeyModName :: NodeKey -> Maybe ModuleName
- type ModNodeKey = ModuleNameWithIsBoot
- data ModNodeKeyWithUid = ModNodeKeyWithUid {
  - mnkModuleName :: !ModuleNameWithIsBoot
  - mnkUnitId :: !UnitId
  }
- mnkToModule :: ModNodeKeyWithUid -> Module
- moduleToMnk :: Module -> IsBootInterface -> ModNodeKeyWithUid
- mnkToInstalledModule :: ModNodeKeyWithUid -> InstalledModule
- installedModuleToMnk :: InstalledModule -> ModNodeKeyWithUid
- mnkIsBoot :: ModNodeKeyWithUid -> IsBootInterface
- msKey :: ModSummary -> ModNodeKeyWithUid
- mnKey :: ModuleNodeInfo -> ModNodeKeyWithUid
- miKey :: ModIface -> ModNodeKeyWithUid
- data ImportLevel
  - = NormalLevel
  - | SpliceLevel
  - | QuoteLevel
- type SummaryNode = Node Int ModuleGraphNode
- summaryNodeSummary :: SummaryNode -> ModuleGraphNode
- summaryNodeKey :: SummaryNode -> Int

# Construct a module graph

A module graph should be constructed once by downsweep and never modified.

data ModuleGraph #

A '`ModuleGraph`' contains all the nodes from the home package (only). See '`ModuleGraphNode`' for information about the nodes.

Modules need to be compiled. hs-boots need to be typechecked before the associated "real" module so modules with {-# SOURCE #-} imports can be built. Instantiations also need to be typechecked to ensure that the module fits the signature. Substantiation typechecking is roughly comparable to the check that the module and its hs-boot agree.

The graph is not necessarily stored in topologically-sorted order. Use `topSortModuleGraph` and `flattenSCC` to achieve this.

Constructors

ModuleGraph |
Fields mg_mss :: [ModuleGraphNode] mg_graph :: (ReachabilityIndex SummaryNode, NodeKey -> Maybe SummaryNode) mg_loop_graph :: (ReachabilityIndex SummaryNode, NodeKey -> Maybe SummaryNode) mg_zero_graph :: (ReachabilityIndex ZeroSummaryNode, ZeroScopeKey -> Maybe ZeroSummaryNode) mg_has_holes :: !Bool

emptyMG :: ModuleGraph #

Why do we ever need to construct empty graphs? Is it because of one shot mode?

mkModuleGraph :: [ModuleGraphNode] -> ModuleGraph #

Construct a module graph. This function should be the only entry point for building a `ModuleGraph`, since it is supposed to be built once and never modified.

If you ever find the need to build a `ModuleGraph` iteratively, don't add insert and update functions to the API since they become footguns. Instead, design an API that allows iterative construction without posterior modification, perhaps like what is done for building arrays from mutable arrays.

mkModuleGraphChecked :: [ModuleGraphNode] -> Either [ModuleGraphInvariantError] ModuleGraph #

A version of mkModuleGraph that checks the module graph for invariants.

# Invariant checking

checkModuleGraph :: ModuleGraph -> [ModuleGraphInvariantError] #

data ModuleGraphInvariantError #

Constructors

FixedNodeDependsOnCompileNode ModNodeKeyWithUid [NodeKey] |
DuplicateModuleNodeKey NodeKey |
DependencyNotInGraph NodeKey [NodeKey] |

#### Instances

Instances details

Outputable ModuleGraphInvariantError # |
Instance details Defined in GHC.Unit.Module.Graph Methods ppr :: ModuleGraphInvariantError -> SDoc #
Eq ModuleGraphInvariantError # |
Instance details Defined in GHC.Unit.Module.Graph Methods (==) :: ModuleGraphInvariantError -> ModuleGraphInvariantError -> Bool # (/=) :: ModuleGraphInvariantError -> ModuleGraphInvariantError -> Bool #
Ord ModuleGraphInvariantError # |
Instance details Defined in GHC.Unit.Module.Graph Methods compare :: ModuleGraphInvariantError -> ModuleGraphInvariantError -> Ordering # (<) :: ModuleGraphInvariantError -> ModuleGraphInvariantError -> Bool # (<=) :: ModuleGraphInvariantError -> ModuleGraphInvariantError -> Bool # (>) :: ModuleGraphInvariantError -> ModuleGraphInvariantError -> Bool # (>=) :: ModuleGraphInvariantError -> ModuleGraphInvariantError -> Bool # max :: ModuleGraphInvariantError -> ModuleGraphInvariantError -> ModuleGraphInvariantError # min :: ModuleGraphInvariantError -> ModuleGraphInvariantError -> ModuleGraphInvariantError #

# Nodes in a module graph

The user-facing nodes in a module graph are `ModuleGraphNode`s. There are a few things which we can query out of each `ModuleGraphNode`:

- `mgNodeDependencies` gets the immediate dependencies of this node
- `mgNodeUnitId` returns the `UnitId` of that node
- `mgNodeModSum` extracts the `ModSummary` of a node if exists

data ModuleGraphNode #

A '`ModuleGraphNode`' is a node in the '`ModuleGraph`'. Edges between nodes mark dependencies arising from module imports and dependencies arising from backpack instantiations.

Constructors

InstantiationNode UnitId InstantiatedUnit | Instantiation nodes track the instantiation of other units (backpack dependencies) with the holes (signatures) of the current package.
ModuleNode [ModuleNodeEdge] ModuleNodeInfo | There is a module node for each module being built. A node is either fixed or can be compiled. - Fixed modules are not compiled, the artifacts are just loaded from disk. It is up to your to make sure the artifacts are up to date and available. - Compile modules are compiled from source if needed.
LinkNode [NodeKey] UnitId | Link nodes are whether are are creating a linked product (ie executable/shared object etc) for a unit.
UnitNode [UnitId] UnitId | Package dependency

#### Instances

Instances details

Outputable ModuleGraphNode # |
Instance details Defined in GHC.Unit.Module.Graph Methods ppr :: ModuleGraphNode -> SDoc #
Eq ModuleGraphNode # |
Instance details Defined in GHC.Unit.Module.Graph Methods (==) :: ModuleGraphNode -> ModuleGraphNode -> Bool # (/=) :: ModuleGraphNode -> ModuleGraphNode -> Bool #
Ord ModuleGraphNode # |
Instance details Defined in GHC.Unit.Module.Graph Methods compare :: ModuleGraphNode -> ModuleGraphNode -> Ordering # (<) :: ModuleGraphNode -> ModuleGraphNode -> Bool # (<=) :: ModuleGraphNode -> ModuleGraphNode -> Bool # (>) :: ModuleGraphNode -> ModuleGraphNode -> Bool # (>=) :: ModuleGraphNode -> ModuleGraphNode -> Bool # max :: ModuleGraphNode -> ModuleGraphNode -> ModuleGraphNode # min :: ModuleGraphNode -> ModuleGraphNode -> ModuleGraphNode #

mgNodeDependencies :: Bool -> ModuleGraphNode -> [NodeKey] #

Collect the immediate dependencies of a ModuleGraphNode, optionally avoiding hs-boot dependencies. If the drop_hs_boot_nodes flag is False, and if this is a .hs and there is an equivalent .hs-boot, add a link from the former to the latter. This has the effect of detecting bogus cases where the .hs-boot depends on the .hs, by introducing a cycle. Additionally, it ensures that we will always process the .hs-boot before the .hs, and so the HomePackageTable will always have the most up to date information.

mgNodeIsModule :: ModuleGraphNode -> Maybe ModuleNodeInfo #

mgNodeUnitId :: ModuleGraphNode -> UnitId #

data ModuleNodeEdge #

Constructors

ModuleNodeEdge |
Fields edgeLevel :: ImportLevel edgeTargetKey :: NodeKey

#### Instances

Instances details

Outputable ModuleNodeEdge # |
Instance details Defined in GHC.Unit.Module.Graph Methods ppr :: ModuleNodeEdge -> SDoc #

mkModuleEdge :: ImportLevel -> NodeKey -> ModuleNodeEdge #

mkNormalEdge :: NodeKey -> ModuleNodeEdge #

A `normal` edge in the graph which isn't offset by an import stage.

data ModuleNodeInfo #

Constructors

ModuleNodeFixed ModNodeKeyWithUid ModLocation |
ModuleNodeCompile ModSummary |

moduleNodeInfoModule :: ModuleNodeInfo -> Module #

Extract the Module from a ModuleNodeInfo

moduleNodeInfoUnitId :: ModuleNodeInfo -> UnitId #

moduleNodeInfoMnwib :: ModuleNodeInfo -> ModuleNameWithIsBoot #

moduleNodeInfoModuleName :: ModuleNodeInfo -> ModuleName #

Extract the ModuleName from a ModuleNodeInfo

moduleNodeInfoModNodeKeyWithUid :: ModuleNodeInfo -> ModNodeKeyWithUid #

Extract the ModNodeKeyWithUid from a ModuleNodeInfo

moduleNodeInfoHscSource :: ModuleNodeInfo -> Maybe HscSource #

Extract the HscSource from a ModuleNodeInfo, if we can determine it.

moduleNodeInfoLocation :: ModuleNodeInfo -> ModLocation #

Extract the ModLocation from a ModuleNodeInfo

isBootModuleNodeInfo :: ModuleNodeInfo -> IsBootInterface #

Extract the IsBootInterface from a ModuleNodeInfo

# Module graph operations

lengthMG :: ModuleGraph -> Int #

Returns the number of nodes in a `ModuleGraph`

isEmptyMG :: ModuleGraph -> Bool #

## `ModSummary` operations

A couple of operations on the module graph allow access to the `ModSummary`s of the modules in it contained.

In particular, `mapMG` and `mapMGM` allow updating these `ModSummary`s (without changing the `ModuleGraph` structure itself!). `mgModSummaries` lists out all `ModSummary`s, and `mgLookupModule` looks up a `ModSummary` for a given module.

mapMG :: (ModSummary -> ModSummary) -> ModuleGraph -> ModuleGraph #

Map a function `f` over all the `ModSummaries`. To preserve invariants, `f` can't change the isBoot status.

mgMapM :: (ModuleNodeInfo -> IO ModuleNodeInfo) -> ModuleGraph -> IO ModuleGraph #

Map a function `f` over all the `ModSummaries`, in `IO`. To preserve invariants, `f` can't change the isBoot status.

mgModSummaries :: ModuleGraph -> [ModSummary] #

mgLookupModule :: ModuleGraph -> Module -> Maybe ModuleNodeInfo #

Look up a non-boot ModSummary in the ModuleGraph.

Careful: Linear in the size of the module graph MP: This should probably be level aware

mgLookupModuleName :: ModuleGraph -> ModuleNameWithIsBoot -> [ModuleNodeInfo] #

Lookup up a `ModuleNameWithIsBoot` in the `ModuleGraph`.

Multiple nodes in the `ModuleGraph` can have the same `ModuleName` and `IsBootInterface`.

Careful: Linear in the size of the module graph.

mgHasHoles :: ModuleGraph -> Bool #

A function you should not need to use, or desire to use. Only used in one place, `Load` to facilitate a misimplementation in Backpack.

showModMsg :: DynFlags -> Bool -> ModuleGraphNode -> SDoc #

## Reachability queries

A module graph explains the structure and relationship between the modules being compiled. Often times, this structure is relevant to answer reachability queries -- is X reachable from Y; or, what is the transitive closure of Z?

mgReachable :: ModuleGraph -> NodeKey -> Maybe [ModuleGraphNode] #

Return all nodes reachable from the given `NodeKey`.

`Nothing` if the key couldn't be found in the graph.

mgReachableLoop :: ModuleGraph -> [NodeKey] -> [ModuleGraphNode] #

Things which are reachable if hs-boot files are ignored. Used by `getLinkDeps`

mgQuery #

Arguments

:: ModuleGraph |
    g
-> NodeKey |
    a
-> NodeKey |
    b
-> Bool | `b` is reachable from `a`

Reachability Query.

`mgQuery(g, a, b)` asks: Can we reach `b` from `a` in graph `g`?

Both `a` and `b` must be in `g`.

data ZeroScopeKey #

The `ZeroScopeKey` indicates the different scopes which we can refer to in a zero-scope query.

Constructors

ModuleScope ModNodeKeyWithUid ImportLevel |
UnitScope UnitId |

#### Instances

Instances details

Outputable ZeroScopeKey # |
Instance details Defined in GHC.Unit.Module.Graph Methods ppr :: ZeroScopeKey -> SDoc #
Eq ZeroScopeKey # |
Instance details Defined in GHC.Unit.Module.Graph Methods (==) :: ZeroScopeKey -> ZeroScopeKey -> Bool # (/=) :: ZeroScopeKey -> ZeroScopeKey -> Bool #
Ord ZeroScopeKey # |
Instance details Defined in GHC.Unit.Module.Graph Methods compare :: ZeroScopeKey -> ZeroScopeKey -> Ordering # (<) :: ZeroScopeKey -> ZeroScopeKey -> Bool # (<=) :: ZeroScopeKey -> ZeroScopeKey -> Bool # (>) :: ZeroScopeKey -> ZeroScopeKey -> Bool # (>=) :: ZeroScopeKey -> ZeroScopeKey -> Bool # max :: ZeroScopeKey -> ZeroScopeKey -> ZeroScopeKey # min :: ZeroScopeKey -> ZeroScopeKey -> ZeroScopeKey #

mgQueryZero :: ModuleGraph -> ZeroScopeKey -> ZeroScopeKey -> Bool #

``mgQueryZero` g root b` answers the question: can we reach `b` from `root` in the module graph `g`, only using normal (level 0) imports?

mgQueryMany #

Arguments

:: ModuleGraph |
    g
-> [NodeKey] |
    roots
-> NodeKey |
    b
-> Bool | `b` is reachable from `roots`

Many roots reachability Query.

`mgQuery(g, roots, b)` asks: Can we reach `b` from any of the `roots` in graph `g`?

Node `b` must be in `g`.

mgQueryManyZero #

Arguments

:: ModuleGraph |
    g
-> [ZeroScopeKey] |
    roots
-> ZeroScopeKey |
    b
-> Bool | `b` is reachable from `roots`

Many roots reachability Query.

`mgQuery(g, roots, b)` asks: Can we reach `b` from any of the `roots` in graph `g`, only using normal (level 0) imports?

Node `b` must be in `g`.

mgMember :: ModuleGraph -> NodeKey -> Bool #

## Other operations

These operations allow more-internal-than-ideal access to the ModuleGraph structure. Ideally, we could restructure the code using these functions to avoid deconstructing/reconstructing the ModuleGraph and instead extend the "proper interface" of the ModuleGraph to achieve what is currently done but through a better abstraction.

mgModSummaries' :: ModuleGraph -> [ModuleGraphNode] #

moduleGraphNodes :: Bool -> [ModuleGraphNode] -> (Graph SummaryNode, NodeKey -> Maybe SummaryNode) #

Turn a list of graph nodes into an efficient queriable graph. The first boolean parameter indicates whether nodes corresponding to hs-boot files should be collapsed into their relevant hs nodes.

moduleGraphModulesBelow :: ModuleGraph -> UnitId -> ModuleNameWithIsBoot -> Set ModNodeKeyWithUid #

This function returns all the modules belonging to the home-unit that can be reached by following the given dependencies. Additionally, if both the boot module and the non-boot module can be reached, it only returns the non-boot one.

filterToposortToModules :: [SCC ModuleGraphNode] -> [SCC ModuleNodeInfo] #

This function filters out all the instantiation nodes from each SCC of a topological sort. Use this with care, as the resulting "strongly connected components" may not really be strongly connected in a direct way, as instantiations have been removed. It would probably be best to eliminate uses of this function where possible.

moduleGraphNodesZero :: [ModuleGraphNode] -> (Graph ZeroSummaryNode, ZeroScopeKey -> Maybe ZeroSummaryNode) #

Turn a list of graph nodes into an efficient queriable graph. This graph only has edges between level-0 imports

This query answers the question. If I am looking at level n in module M then which modules are visible?

If you are looking at level -1 then the reachable modules are those imported at splice and then any modules those modules import at zero. (Ie the zero scope for those modules)

type StageSummaryNode = Node Int (NodeKey, ModuleStage) #

stageSummaryNodeSummary :: StageSummaryNode -> (NodeKey, ModuleStage) #

stageSummaryNodeKey :: StageSummaryNode -> Int #

mkStageDeps :: [ModuleGraphNode] -> (ReachabilityIndex StageSummaryNode, (NodeKey, ModuleStage) -> Maybe StageSummaryNode) #

Transitive dependencies, but with the stage that each module is required at.

# Keys into the `ModuleGraph`

data NodeKey #

Constructors

NodeKey_Unit !InstantiatedUnit |
NodeKey_Module !ModNodeKeyWithUid |
NodeKey_Link !UnitId |
NodeKey_ExternalUnit !UnitId |

#### Instances

Instances details

Outputable NodeKey # |
Instance details Defined in GHC.Unit.Module.Graph Methods ppr :: NodeKey -> SDoc #
Eq NodeKey # |
Instance details Defined in GHC.Unit.Module.Graph Methods (==) :: NodeKey -> NodeKey -> Bool # (/=) :: NodeKey -> NodeKey -> Bool #
Ord NodeKey # |
Instance details Defined in GHC.Unit.Module.Graph Methods compare :: NodeKey -> NodeKey -> Ordering # (<) :: NodeKey -> NodeKey -> Bool # (<=) :: NodeKey -> NodeKey -> Bool # (>) :: NodeKey -> NodeKey -> Bool # (>=) :: NodeKey -> NodeKey -> Bool # max :: NodeKey -> NodeKey -> NodeKey # min :: NodeKey -> NodeKey -> NodeKey #

mkNodeKey :: ModuleGraphNode -> NodeKey #

nodeKeyUnitId :: NodeKey -> UnitId #

nodeKeyModName :: NodeKey -> Maybe ModuleName #

type ModNodeKey = ModuleNameWithIsBoot #

data ModNodeKeyWithUid #

Constructors

ModNodeKeyWithUid |
Fields mnkModuleName :: !ModuleNameWithIsBoot mnkUnitId :: !UnitId

#### Instances

Instances details

Outputable ModNodeKeyWithUid # |
Instance details Defined in GHC.Unit.Module.ModNodeKey Methods ppr :: ModNodeKeyWithUid -> SDoc #
Eq ModNodeKeyWithUid # |
Instance details Defined in GHC.Unit.Module.ModNodeKey Methods (==) :: ModNodeKeyWithUid -> ModNodeKeyWithUid -> Bool # (/=) :: ModNodeKeyWithUid -> ModNodeKeyWithUid -> Bool #
Ord ModNodeKeyWithUid # |
Instance details Defined in GHC.Unit.Module.ModNodeKey Methods compare :: ModNodeKeyWithUid -> ModNodeKeyWithUid -> Ordering # (<) :: ModNodeKeyWithUid -> ModNodeKeyWithUid -> Bool # (<=) :: ModNodeKeyWithUid -> ModNodeKeyWithUid -> Bool # (>) :: ModNodeKeyWithUid -> ModNodeKeyWithUid -> Bool # (>=) :: ModNodeKeyWithUid -> ModNodeKeyWithUid -> Bool # max :: ModNodeKeyWithUid -> ModNodeKeyWithUid -> ModNodeKeyWithUid # min :: ModNodeKeyWithUid -> ModNodeKeyWithUid -> ModNodeKeyWithUid #

mnkToModule :: ModNodeKeyWithUid -> Module #

moduleToMnk :: Module -> IsBootInterface -> ModNodeKeyWithUid #

mnkToInstalledModule :: ModNodeKeyWithUid -> InstalledModule #

installedModuleToMnk :: InstalledModule -> ModNodeKeyWithUid #

Already InstalledModules are always NotBoot

mnkIsBoot :: ModNodeKeyWithUid -> IsBootInterface #

msKey :: ModSummary -> ModNodeKeyWithUid #

mnKey :: ModuleNodeInfo -> ModNodeKeyWithUid #

miKey :: ModIface -> ModNodeKeyWithUid #

data ImportLevel #

ImportLevel

Constructors

NormalLevel |
SpliceLevel |
QuoteLevel |

#### Instances

Instances details

Data ImportLevel # |
Instance details Defined in GHC.Types.Basic Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ImportLevel -> c ImportLevel # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ImportLevel # toConstr :: ImportLevel -> Constr # dataTypeOf :: ImportLevel -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ImportLevel) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ImportLevel) # gmapT :: (forall b. Data b => b -> b) -> ImportLevel -> ImportLevel # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ImportLevel -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ImportLevel -> r # gmapQ :: (forall d. Data d => d -> u) -> ImportLevel -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ImportLevel -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ImportLevel -> m ImportLevel # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ImportLevel -> m ImportLevel # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ImportLevel -> m ImportLevel #
Bounded ImportLevel # |
Instance details Defined in GHC.Types.Basic Methods minBound :: ImportLevel # maxBound :: ImportLevel #
Enum ImportLevel # |
Instance details Defined in GHC.Types.Basic Methods succ :: ImportLevel -> ImportLevel # pred :: ImportLevel -> ImportLevel # toEnum :: Int -> ImportLevel # fromEnum :: ImportLevel -> Int # enumFrom :: ImportLevel -> [ImportLevel] # enumFromThen :: ImportLevel -> ImportLevel -> [ImportLevel] # enumFromTo :: ImportLevel -> ImportLevel -> [ImportLevel] # enumFromThenTo :: ImportLevel -> ImportLevel -> ImportLevel -> [ImportLevel] #
Show ImportLevel # |
Instance details Defined in GHC.Types.Basic Methods showsPrec :: Int -> ImportLevel -> ShowS # show :: ImportLevel -> String # showList :: [ImportLevel] -> ShowS #
Binary ImportLevel # |
Instance details Defined in GHC.Types.Basic Methods put_ :: WriteBinHandle -> ImportLevel -> IO () # put :: WriteBinHandle -> ImportLevel -> IO (Bin ImportLevel) # get :: ReadBinHandle -> IO ImportLevel #
Outputable ImportLevel # |
Instance details Defined in GHC.Types.Basic Methods ppr :: ImportLevel -> SDoc #
Eq ImportLevel # |
Instance details Defined in GHC.Types.Basic Methods (==) :: ImportLevel -> ImportLevel -> Bool # (/=) :: ImportLevel -> ImportLevel -> Bool #
Ord ImportLevel # |
Instance details Defined in GHC.Types.Basic Methods compare :: ImportLevel -> ImportLevel -> Ordering # (<) :: ImportLevel -> ImportLevel -> Bool # (<=) :: ImportLevel -> ImportLevel -> Bool # (>) :: ImportLevel -> ImportLevel -> Bool # (>=) :: ImportLevel -> ImportLevel -> Bool # max :: ImportLevel -> ImportLevel -> ImportLevel # min :: ImportLevel -> ImportLevel -> ImportLevel #

## Internal node representation

`SummaryNode` is the internal representation for each node stored in the graph. It's not immediately clear to me why users do depend on them.

type SummaryNode = Node Int ModuleGraphNode #

summaryNodeSummary :: SummaryNode -> ModuleGraphNode #

summaryNodeKey :: SummaryNode -> Int #