HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulecabal-install-3.12.1.0Haskell2010

Distribution.Client.InstallPlan

Package installation plan

  • 8 types
  • 30 values
datadata GenericPlanPackage ipkg srcpkg
#

Packages in an install plan

NOTE: ConfiguredPackage, GenericReadyPackage and GenericPlanPackage intentionally have no PackageInstalled instance. `This is important: PackageInstalled returns only library dependencies, but for package that aren't yet installed we know many more kinds of dependencies (setup dependencies, exe, test-suite, benchmark, ..). Any functions that operate on dependencies in cabal-install should consider what to do with these dependencies; if we give a PackageInstalled instance it would be too easy to get this wrong (and, for instance, call graph traversal functions from Cabal rather than from cabal-install). Instead, see PackageInstalled.

Constructors

Instances12Eq, Show, Generic, Binary, Structured, IsNode, …

Operations on InstallPlans

16 declarations
valueremove
  1. :: (IsUnit ipkg, IsUnit srcpkg)
  2. => GenericPlanPackage ipkg srcpkg -> Bool
  3. -> GenericInstallPlan ipkg srcpkg
  4. -> GenericInstallPlan ipkg srcpkg
#

Remove packages from the install plan. This will result in an error if there are remaining packages that depend on any matching package. This is primarily useful for obtaining an install plan for the dependencies of a package or set of packages without actually installing the package itself, as when doing development.

Traversal

4 declarations
valueexecutionOrder
  1. :: (IsUnit ipkg, IsUnit srcpkg)
  2. => GenericInstallPlan ipkg srcpkg
  3. -> [GenericReadyPackage srcpkg]
#

Flatten an InstallPlan, producing the sequence of source packages in the order in which they would be processed when the plan is executed. This can be used for simulations or presenting execution dry-runs.

It is guaranteed to give the same order as using execute (with a serial in-order JobControl), which is a reverse topological orderings of the source packages in the dependency graph, albeit not necessarily exactly the same ordering as that produced by reverseTopologicalOrder.

valueexecute
  1. :: (IsUnit ipkg, IsUnit srcpkg, Monad m)
  2. => JobControl m (UnitId, Either failure result)
  3. -> Bool

    Keep going after failure

  4. -> (srcpkg -> failure)

    Value for dependents of failed packages

  5. -> GenericInstallPlan ipkg srcpkg
  6. -> (GenericReadyPackage srcpkg -> m (Either failure result))
  7. -> m (BuildOutcomes failure result)
#

Execute an install plan. This traverses the plan in dependency order.

Executing each individual package can fail and if so all dependents fail too. The result for each package is collected as a BuildOutcomes map.

Visiting each package happens with optional parallelism, as determined by the JobControl. By default, after any failure we stop as soon as possible (using the JobControl to try to cancel in-progress tasks). This behaviour can be reversed to keep going and build as many packages as possible.

Note that the BuildOutcomes is not guaranteed to cover all the packages in the plan. In particular in the default mode where we stop as soon as possible after a failure then there may be packages which are skipped and these will have no BuildOutcome.

Traversal helpers

Algorithms to traverse or execute an InstallPlan, especially in parallel, may make use of the Processing type and the associated operations ready, completed and failed.

The Processing type is used to keep track of the state of a traversal and includes the set of packages that are in the processing state, e.g. in the process of being installed, plus those that have been completed and those where processing failed.

Traversal algorithms start with an InstallPlan:

  • Initially there will be certain packages that can be processed immediately (since they are configured source packages and have all their dependencies installed already). The function ready returns these packages plus a Processing state that marks these same packages as being in the processing state.

  • The algorithm must now arrange for these packages to be processed (possibly in parallel). When a package has completed processing, the algorithm needs to know which other packages (if any) are now ready to process as a result. The completed function marks a package as completed and returns any packages that are newly in the processing state (ie ready to process), along with the updated Processing state.

  • If failure is possible then when processing a package fails, the algorithm needs to know which other packages have also failed as a result. The failed function marks the given package as failed as well as all the other packages that depend on the failed package. In addition it returns the other failed packages.

datadata Processing
#

The Processing type is used to keep track of the state of a traversal and includes the set of packages that are in the processing state, e.g. in the process of being installed, plus those that have been completed and those where processing failed.

valueready
  1. :: (IsUnit ipkg, IsUnit srcpkg)
  2. => GenericInstallPlan ipkg srcpkg
  3. -> ([GenericReadyPackage srcpkg], Processing)
#

The packages in the plan that are initially ready to be installed. That is they are in the configured state and have all their dependencies installed already.

The result is both the packages that are now ready to be installed and also a Processing state containing those same packages. The assumption is that all the packages that are ready will now be processed and so we can consider them to be in the processing state.

Display

5 declarations

Graph-like operations

3 declarations
valuereverseTopologicalOrder
  1. :: GenericInstallPlan ipkg srcpkg
  2. -> [GenericPlanPackage ipkg srcpkg]
#

Return all the packages in the InstallPlan in reverse topological order. That is, for each package, all dependencies of the package appear first.

Compared to executionOrder, this function returns all the installed and source packages rather than just the source ones. Also, while both this and executionOrder produce reverse topological orderings of the package dependency graph, it is not necessarily exactly the same order.