Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Var qpn
- showVar :: Var QPN -> String
- varPN :: Var qpn -> qpn
- data ConflictSet
- type ConflictMap = Map (Var QPN) Int
- showConflictSet :: ConflictSet -> String
- data CI
- = Fixed I
- | Constrained VR
- type FlaggedDeps qpn = [FlaggedDep qpn]
- data FlaggedDep qpn
- data LDep qpn = LDep (DependencyReason qpn) (Dep qpn)
- data Dep qpn
- = Dep (PkgComponent qpn) CI
- | Ext Extension
- | Lang Language
- | Pkg PkgconfigName PkgconfigVersionRange
- data PkgComponent qpn = PkgComponent qpn ExposedComponent
- data ExposedComponent
- data DependencyReason qpn = DependencyReason qpn (Map Flag FlagValue) (Set Stanza)
- showDependencyReason :: DependencyReason QPN -> String
- flattenFlaggedDeps :: FlaggedDeps qpn -> [(LDep qpn, Component)]
- data QualifyOptions = QO {}
- qualifyDeps :: QualifyOptions -> QPN -> FlaggedDeps PN -> FlaggedDeps QPN
- unqualifyDeps :: FlaggedDeps QPN -> FlaggedDeps PN
- type RevDepMap = Map QPN [(Component, QPN)]
- data Goal qpn = Goal (Var qpn) (GoalReason qpn)
- data GoalReason qpn
- = UserGoal
- | DependencyGoal (DependencyReason qpn)
- type QGoalReason = GoalReason QPN
- goalToVar :: Goal a -> Var a
- varToConflictSet :: Var QPN -> ConflictSet
- goalReasonToConflictSet :: GoalReason QPN -> ConflictSet
- goalReasonToConflictSetWithConflict :: QPN -> GoalReason QPN -> ConflictSet
- dependencyReasonToConflictSet :: DependencyReason QPN -> ConflictSet
- dependencyReasonToConflictSetWithVersionConstraintConflict :: QPN -> Ver -> DependencyReason QPN -> ConflictSet
- dependencyReasonToConflictSetWithVersionConflict :: QPN -> OrderedVersionRange -> DependencyReason QPN -> ConflictSet
Variables
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.
Conflict sets
data ConflictSet Source #
The set of variables involved in a solver conflict, each paired with details about the conflict.
Instances
Show ConflictSet Source # | |
Defined in Distribution.Solver.Modular.ConflictSet showsPrec :: Int -> ConflictSet -> ShowS # show :: ConflictSet -> String # showList :: [ConflictSet] -> ShowS # | |
Eq ConflictSet Source # | |
Defined in Distribution.Solver.Modular.ConflictSet (==) :: ConflictSet -> ConflictSet -> Bool # (/=) :: ConflictSet -> ConflictSet -> Bool # | |
Ord ConflictSet Source # | |
Defined in Distribution.Solver.Modular.ConflictSet compare :: ConflictSet -> ConflictSet -> Ordering # (<) :: ConflictSet -> ConflictSet -> Bool # (<=) :: ConflictSet -> ConflictSet -> Bool # (>) :: ConflictSet -> ConflictSet -> Bool # (>=) :: ConflictSet -> ConflictSet -> Bool # max :: ConflictSet -> ConflictSet -> ConflictSet # min :: ConflictSet -> ConflictSet -> ConflictSet # |
showConflictSet :: ConflictSet -> String Source #
Constrained instances
Constrained instance. It represents the allowed instances for a package, which can be either a fixed instance or a version range.
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.
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 |
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.)
LDep (DependencyReason qpn) (Dep qpn) |
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.
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 |
data PkgComponent qpn Source #
An exposed component within a package. This type is used to represent build-depends and build-tool-depends dependencies.
Instances
data ExposedComponent Source #
A component that can be depended upon by another package, i.e., a library or an executable.
Instances
Show ExposedComponent Source # | |
Defined in Distribution.Solver.Modular.Dependency showsPrec :: Int -> ExposedComponent -> ShowS # show :: ExposedComponent -> String # showList :: [ExposedComponent] -> ShowS # | |
Eq ExposedComponent Source # | |
Defined in Distribution.Solver.Modular.Dependency (==) :: ExposedComponent -> ExposedComponent -> Bool # (/=) :: ExposedComponent -> ExposedComponent -> Bool # | |
Ord ExposedComponent Source # | |
Defined in Distribution.Solver.Modular.Dependency compare :: ExposedComponent -> ExposedComponent -> Ordering # (<) :: ExposedComponent -> ExposedComponent -> Bool # (<=) :: ExposedComponent -> ExposedComponent -> Bool # (>) :: ExposedComponent -> ExposedComponent -> Bool # (>=) :: ExposedComponent -> ExposedComponent -> Bool # max :: ExposedComponent -> ExposedComponent -> ExposedComponent # min :: ExposedComponent -> ExposedComponent -> ExposedComponent # |
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
Functor DependencyReason Source # | |
Defined in Distribution.Solver.Modular.Dependency fmap :: (a -> b) -> DependencyReason a -> DependencyReason b # (<$) :: a -> DependencyReason b -> DependencyReason a # | |
Show qpn => Show (DependencyReason qpn) Source # | |
Defined in Distribution.Solver.Modular.Dependency showsPrec :: Int -> DependencyReason qpn -> ShowS # show :: DependencyReason qpn -> String # showList :: [DependencyReason qpn] -> ShowS # | |
Eq qpn => Eq (DependencyReason qpn) Source # | |
Defined in Distribution.Solver.Modular.Dependency (==) :: DependencyReason qpn -> DependencyReason qpn -> Bool # (/=) :: DependencyReason qpn -> DependencyReason qpn -> Bool # |
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
QO | |
|
Instances
Show QualifyOptions Source # | |
Defined in Distribution.Solver.Modular.Dependency showsPrec :: Int -> QualifyOptions -> ShowS # show :: QualifyOptions -> String # showList :: [QualifyOptions] -> ShowS # |
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
A goal is just a solver variable paired with a reason. The reason is only used for tracing.
Goal (Var qpn) (GoalReason qpn) |
data GoalReason qpn Source #
Reason why a goal is being added to a goal set.
Instances
Functor GoalReason Source # | |
Defined in Distribution.Solver.Modular.Dependency fmap :: (a -> b) -> GoalReason a -> GoalReason b # (<$) :: a -> GoalReason b -> GoalReason a # | |
Show qpn => Show (GoalReason qpn) Source # | |
Defined in Distribution.Solver.Modular.Dependency showsPrec :: Int -> GoalReason qpn -> ShowS # show :: GoalReason qpn -> String # showList :: [GoalReason qpn] -> ShowS # | |
Eq qpn => Eq (GoalReason qpn) Source # | |
Defined in Distribution.Solver.Modular.Dependency (==) :: GoalReason qpn -> GoalReason qpn -> Bool # (/=) :: GoalReason qpn -> GoalReason qpn -> Bool # |
type QGoalReason = GoalReason QPN Source #
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
.