Cabal-3.10.1.0: A framework for packaging Haskell software

Safe Haskell | Safe-Inferred
Language | Haskell2010

Distribution.Backpack.ComponentsGraph

Description

See https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst

Synopsis

- type ComponentsGraph = Graph (Node ComponentName Component)
- type ComponentsWithDeps = [(Component, [ComponentName])]
- mkComponentsGraph :: ComponentRequestedSpec -> PackageDescription -> Either [ComponentName] ComponentsGraph
- componentsGraphToList :: ComponentsGraph -> ComponentsWithDeps
- dispComponentsWithDeps :: ComponentsWithDeps -> Doc
- componentCycleMsg :: PackageIdentifier -> [ComponentName] -> Doc

# Documentation

type ComponentsGraph = Graph (Node ComponentName Component) Source #

A graph of source-level components by their source-level dependencies

type ComponentsWithDeps = [(Component, [ComponentName])] Source #

A list of components associated with the source level dependencies between them.

mkComponentsGraph :: ComponentRequestedSpec -> PackageDescription -> Either [ComponentName] ComponentsGraph Source #

Create a `Graph` of `Component`, or report a cycle if there is a problem.

componentsGraphToList :: ComponentsGraph -> ComponentsWithDeps Source #

Given the package description and a `PackageDescription` (used to determine if a package name is internal or not), sort the components in dependency order (fewest dependencies first). This is NOT necessarily the build order (although it is in the absence of Backpack.)

dispComponentsWithDeps :: ComponentsWithDeps -> Doc Source #

Pretty-print `ComponentsWithDeps`.

componentCycleMsg :: PackageIdentifier -> [ComponentName] -> Doc Source #

Error message when there is a cycle; takes the SCC of components.