cabal-install-solver-3.10.1.0: The command-line interface for Cabal and Hackage.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Distribution.Solver.Modular.Dependency

Synopsis

Variables

data Var qpn Source #

The type of variables that play a role in the solver. Note that the tree currently does not use this type directly, and rather has separate tree nodes for the different types of variables. This fits better with the fact that in most cases, these have to be treated differently.

Constructors

P qpn 
F (FN qpn) 
S (SN qpn) 

Instances

Instances details
Functor Var Source # 
Instance details

Defined in Distribution.Solver.Modular.Var

Methods

fmap :: (a -> b) -> Var a -> Var b #

(<$) :: a -> Var b -> Var a #

Show qpn => Show (Var qpn) Source # 
Instance details

Defined in Distribution.Solver.Modular.Var

Methods

showsPrec :: Int -> Var qpn -> ShowS #

show :: Var qpn -> String #

showList :: [Var qpn] -> ShowS #

Eq qpn => Eq (Var qpn) Source # 
Instance details

Defined in Distribution.Solver.Modular.Var

Methods

(==) :: Var qpn -> Var qpn -> Bool #

(/=) :: Var qpn -> Var qpn -> Bool #

Ord qpn => Ord (Var qpn) Source # 
Instance details

Defined in Distribution.Solver.Modular.Var

Methods

compare :: Var qpn -> Var qpn -> Ordering #

(<) :: Var qpn -> Var qpn -> Bool #

(<=) :: Var qpn -> Var qpn -> Bool #

(>) :: Var qpn -> Var qpn -> Bool #

(>=) :: Var qpn -> Var qpn -> Bool #

max :: Var qpn -> Var qpn -> Var qpn #

min :: Var qpn -> Var qpn -> Var qpn #

varPN :: Var qpn -> qpn Source #

Extract the package name from a Var

Conflict sets

data ConflictSet Source #

The set of variables involved in a solver conflict, each paired with details about the conflict.

Constrained instances

data CI Source #

Constrained instance. It represents the allowed instances for a package, which can be either a fixed instance or a version range.

Constructors

Fixed I 
Constrained VR 

Instances

Instances details
Show CI Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Methods

showsPrec :: Int -> CI -> ShowS #

show :: CI -> String #

showList :: [CI] -> ShowS #

Eq CI Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Methods

(==) :: CI -> CI -> Bool #

(/=) :: CI -> CI -> Bool #

Flagged dependencies

type FlaggedDeps qpn = [FlaggedDep qpn] Source #

Flagged dependencies

FlaggedDeps is the modular solver's view of a packages dependencies: rather than having the dependencies indexed by component, each dependency defines what component it is in.

Note that each dependency is associated with a Component. We must know what component the dependencies belong to, or else we won't be able to construct fine-grained reverse dependencies.

data FlaggedDep qpn Source #

Flagged dependencies can either be plain dependency constraints, or flag-dependent dependency trees.

Constructors

Flagged (FN qpn) FInfo (TrueFlaggedDeps qpn) (FalseFlaggedDeps qpn)

Dependencies which are conditional on a flag choice.

Stanza (SN qpn) (TrueFlaggedDeps qpn)

Dependencies which are conditional on whether or not a stanza (e.g., a test suite or benchmark) is enabled.

Simple (LDep qpn) Component

Dependencies which are always enabled, for the component comp.

data LDep qpn Source #

A Dep labeled with the reason it was introduced.

LDep intentionally has no Functor instance because the type variable is used both to record the dependencies as well as who's doing the depending; having a Functor instance makes bugs where we don't distinguish these two far too likely. (By rights LDep ought to have two type variables.)

Constructors

LDep (DependencyReason qpn) (Dep qpn) 

data Dep qpn Source #

A dependency (constraint) associates a package name with a constrained instance. It can also represent other types of dependencies, such as dependencies on language extensions.

Constructors

Dep (PkgComponent qpn) CI

dependency on a package component

Ext Extension

dependency on a language extension

Lang Language

dependency on a language version

Pkg PkgconfigName PkgconfigVersionRange

dependency on a pkg-config package

Instances

Instances details
Functor Dep Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Methods

fmap :: (a -> b) -> Dep a -> Dep b #

(<$) :: a -> Dep b -> Dep a #

data PkgComponent qpn Source #

An exposed component within a package. This type is used to represent build-depends and build-tool-depends dependencies.

Constructors

PkgComponent qpn ExposedComponent 

Instances

Instances details
Functor PkgComponent Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Methods

fmap :: (a -> b) -> PkgComponent a -> PkgComponent b #

(<$) :: a -> PkgComponent b -> PkgComponent a #

Show qpn => Show (PkgComponent qpn) Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Eq qpn => Eq (PkgComponent qpn) Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Methods

(==) :: PkgComponent qpn -> PkgComponent qpn -> Bool #

(/=) :: PkgComponent qpn -> PkgComponent qpn -> Bool #

Ord qpn => Ord (PkgComponent qpn) Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

data DependencyReason qpn Source #

The reason that a dependency is active. It identifies the package and any flag and stanza choices that introduced the dependency. It contains everything needed for creating ConflictSets or describing conflicts in solver log messages.

Instances

Instances details
Functor DependencyReason Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Methods

fmap :: (a -> b) -> DependencyReason a -> DependencyReason b #

(<$) :: a -> DependencyReason b -> DependencyReason a #

Show qpn => Show (DependencyReason qpn) Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Eq qpn => Eq (DependencyReason qpn) Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

showDependencyReason :: DependencyReason QPN -> String Source #

Print the reason that a dependency was introduced.

flattenFlaggedDeps :: FlaggedDeps qpn -> [(LDep qpn, Component)] Source #

Conservatively flatten out flagged dependencies

NOTE: We do not filter out duplicates.

data QualifyOptions Source #

Options for goal qualification (used in qualifyDeps)

See also defaultQualifyOptions

Constructors

QO 

Fields

Instances

Instances details
Show QualifyOptions Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

qualifyDeps :: QualifyOptions -> QPN -> FlaggedDeps PN -> FlaggedDeps QPN Source #

Apply built-in rules for package qualifiers

Although the behaviour of qualifyDeps depends on the QualifyOptions, it is important that these QualifyOptions are _static_. Qualification does NOT depend on flag assignment; in other words, it behaves the same no matter which choices the solver makes (modulo the global QualifyOptions); we rely on this in linkDeps (see comment there).

NOTE: It's the _dependencies_ of a package that may or may not be independent from the package itself. Package flag choices must of course be consistent.

unqualifyDeps :: FlaggedDeps QPN -> FlaggedDeps PN Source #

Remove qualifiers from set of dependencies

This is used during link validation: when we link package Q.A to Q'.A, then all dependencies Q.B need to be linked to Q'.B. In order to compute what to link these dependencies to, we need to requalify Q.B to become Q'.B; we do this by first removing all qualifiers and then calling qualifyDeps again.

Reverse dependency map

type RevDepMap = Map QPN [(Component, QPN)] Source #

A map containing reverse dependencies between qualified package names.

Goals

data Goal qpn Source #

A goal is just a solver variable paired with a reason. The reason is only used for tracing.

Constructors

Goal (Var qpn) (GoalReason qpn) 

Instances

Instances details
Functor Goal Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Methods

fmap :: (a -> b) -> Goal a -> Goal b #

(<$) :: a -> Goal b -> Goal a #

Show qpn => Show (Goal qpn) Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Methods

showsPrec :: Int -> Goal qpn -> ShowS #

show :: Goal qpn -> String #

showList :: [Goal qpn] -> ShowS #

Eq qpn => Eq (Goal qpn) Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Methods

(==) :: Goal qpn -> Goal qpn -> Bool #

(/=) :: Goal qpn -> Goal qpn -> Bool #

data GoalReason qpn Source #

Reason why a goal is being added to a goal set.

Instances

Instances details
Functor GoalReason Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Methods

fmap :: (a -> b) -> GoalReason a -> GoalReason b #

(<$) :: a -> GoalReason b -> GoalReason a #

Show qpn => Show (GoalReason qpn) Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Methods

showsPrec :: Int -> GoalReason qpn -> ShowS #

show :: GoalReason qpn -> String #

showList :: [GoalReason qpn] -> ShowS #

Eq qpn => Eq (GoalReason qpn) Source # 
Instance details

Defined in Distribution.Solver.Modular.Dependency

Methods

(==) :: GoalReason qpn -> GoalReason qpn -> Bool #

(/=) :: GoalReason qpn -> GoalReason qpn -> Bool #

varToConflictSet :: Var QPN -> ConflictSet Source #

Compute a singleton conflict set from a Var

goalReasonToConflictSet :: GoalReason QPN -> ConflictSet Source #

Convert a GoalReason to a ConflictSet that can be used when the goal leads to a conflict.

goalReasonToConflictSetWithConflict :: QPN -> GoalReason QPN -> ConflictSet Source #

Convert a GoalReason to a ConflictSet containing the reason that the conflict occurred, namely the conflict set variables caused a conflict by introducing the given package goal. See the documentation for GoalConflict.

This function currently only specifies the reason for the conflict in the simple case where the GoalReason does not involve any flags or stanzas. Otherwise, it falls back to calling goalReasonToConflictSet.

dependencyReasonToConflictSet :: DependencyReason QPN -> ConflictSet Source #

This function returns the solver variables responsible for the dependency. It drops the values chosen for flag and stanza variables, which are only needed for log messages.

dependencyReasonToConflictSetWithVersionConstraintConflict :: QPN -> Ver -> DependencyReason QPN -> ConflictSet Source #

Convert a DependencyReason to a ConflictSet specifying that the conflict occurred because the conflict set variables introduced a problematic version constraint. See the documentation for VersionConstraintConflict.

This function currently only specifies the reason for the conflict in the simple case where the DependencyReason does not involve any flags or stanzas. Otherwise, it falls back to calling dependencyReasonToConflictSet.

dependencyReasonToConflictSetWithVersionConflict :: QPN -> OrderedVersionRange -> DependencyReason QPN -> ConflictSet Source #

Convert a DependencyReason to a ConflictSet specifying that the conflict occurred because the conflict set variables introduced a version of a package that was excluded by a version constraint. See the documentation for VersionConflict.

This function currently only specifies the reason for the conflict in the simple case where the DependencyReason does not involve any flags or stanzas. Otherwise, it falls back to calling dependencyReasonToConflictSet.