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.Dependency

Top level interface to dependency resolution.

  • 7 types
  • 31 values

The main package dependency resolver

4 declarations
datadata DepResolverParams
#

The set of parameters to the dependency resolver. These parameters are relatively low level but many kinds of high level policies can be implemented in terms of adjustments to the parameters.

datadata Progress step fail done
#

A type to represent the unfolding of an expensive long running calculation that may fail. We may get intermediate steps before the final result which may be used to indicate progress and/or logging messages.

Constructors

Instances4Monad, Functor, Applicative, Alternative
  • Monad (Progress step fail)Defined in cabal-install-solver-3.12.1.0 · Distribution.Solver.Types.Progress
  • Functor (Progress step fail)Defined in cabal-install-solver-3.12.1.0 · Distribution.Solver.Types.Progress
  • Applicative (Progress step fail)Defined in cabal-install-solver-3.12.1.0 · Distribution.Solver.Types.Progress
  • Monoid fail => Alternative (Progress step fail)Defined in cabal-install-solver-3.12.1.0 · Distribution.Solver.Types.Progress
valuefoldProgress
  1. :: step -> a -> a
  2. -> fail -> a
  3. -> done -> a
  4. -> Progress step fail done
  5. -> a
#

Consume a Progress calculation. Much like foldr for lists but with two base cases, one for a final result and one for failure.

Eg to convert into a simple Either result use:

foldProgress (flip const) Left Right

Alternate, simple resolver that does not do dependencies recursively

1 declaration

A simplistic method of resolving a list of target package names to available packages.

Specifically, it does not consider package dependencies at all. Unlike resolveDependencies, no attempt is made to ensure that the selected packages have dependencies that are satisfiable or consistent with each other.

It is suitable for tasks such as selecting packages to download for user inspection. It is not suitable for selecting packages to install.

Note: if no installed package index is available, it is OK to pass mempty. It simply means preferences for installed packages will be ignored.

Constructing resolver policies

5 declarations
datadata PackageProperty
#
Instances6Eq, Show, Generic, Binary, Structured, Rep

Constructor for a common use case: the constraint applies to the package with the specified name when that package is a top-level dependency in the default namespace.

Global policy for all packages to say if we prefer package versions that are already installed locally or if we just prefer the latest available.

Constructors

  • PreferAllLatest

    Always prefer the latest version irrespective of any existing installed version.

    • This is the standard policy for upgrade.

  • PreferAllOldest

    Always prefer the oldest version irrespective of any existing installed version or packages explicitly requested.

    • This is enabled by --prefer-oldest.

  • PreferAllInstalled

    Always prefer the installed versions over ones that would need to be installed. Secondarily, prefer latest versions (eg the latest installed version or if there are none then the latest source version).

  • PreferLatestForSelected

    Prefer the latest version for packages that are explicitly requested but prefers the installed version for any other packages.

    • This is the standard policy for install.

Instances1Show
datadata PackagePreference
#

A package selection preference for a particular package.

Preferences are soft constraints that the dependency resolver should try to respect where possible. It is not specified if preferences on some packages are more important than others.

Constructors

Standard policy

datadata PackageSpecifier pkg
#

A fully or partially resolved reference to a package.

Constructors

  • NamedPackage PackageName [PackageProperty]

    A partially specified reference to a package (either source or installed). It is specified by package name and optionally some required properties. Use a dependency resolver to pick a specific package satisfying these properties.

  • SpecificSourcePackage pkg

    A fully specified source package.

Instances7Functor, Eq, Show, Generic, Binary, Structured, …

Extra policy options

Policy utils