cabal-install-solver-3.12.1.0: The command-line interface for Cabal and Hackage.

Safe Haskell | None
Language | Haskell2010

Distribution.Solver.Modular.Tree

Synopsis

- data POption = POption I (Maybe PackagePath)
- data Tree d c
  - = PChoice QPN RevDepMap c (WeightedPSQ [Weight] POption (Tree d c))
  - | FChoice QFN RevDepMap c WeakOrTrivial FlagType Bool (WeightedPSQ [Weight] Bool (Tree d c))
  - | SChoice QSN RevDepMap c WeakOrTrivial (WeightedPSQ [Weight] Bool (Tree d c))
  - | GoalChoice RevDepMap (PSQ (Goal QPN) (Tree d c))
  - | Done RevDepMap d
  - | Fail ConflictSet FailReason
- data TreeF d c a
  - = PChoiceF QPN RevDepMap c (WeightedPSQ [Weight] POption a)
  - | FChoiceF QFN RevDepMap c WeakOrTrivial FlagType Bool (WeightedPSQ [Weight] Bool a)
  - | SChoiceF QSN RevDepMap c WeakOrTrivial (WeightedPSQ [Weight] Bool a)
  - | GoalChoiceF RevDepMap (PSQ (Goal QPN) a)
  - | DoneF RevDepMap d
  - | FailF ConflictSet FailReason
- type Weight = Double
- data FailReason
  - = UnsupportedExtension Extension
  - | UnsupportedLanguage Language
  - | MissingPkgconfigPackage PkgconfigName PkgconfigVersionRange
  - | NewPackageDoesNotMatchExistingConstraint ConflictingDep
  - | ConflictingConstraints ConflictingDep ConflictingDep
  - | NewPackageIsMissingRequiredComponent ExposedComponent (DependencyReason QPN)
  - | NewPackageHasPrivateRequiredComponent ExposedComponent (DependencyReason QPN)
  - | NewPackageHasUnbuildableRequiredComponent ExposedComponent (DependencyReason QPN)
  - | PackageRequiresMissingComponent QPN ExposedComponent
  - | PackageRequiresPrivateComponent QPN ExposedComponent
  - | PackageRequiresUnbuildableComponent QPN ExposedComponent
  - | CannotReinstall
  - | NotExplicit
  - | Shadowed
  - | Broken UnitId
  - | UnknownPackage
  - | GlobalConstraintVersion VR ConstraintSource
  - | GlobalConstraintInstalled ConstraintSource
  - | GlobalConstraintSource ConstraintSource
  - | GlobalConstraintFlag ConstraintSource
  - | ManualFlag
  - | MalformedFlagChoice QFN
  - | MalformedStanzaChoice QSN
  - | EmptyGoalChoice
  - | Backjump
  - | MultipleInstances
  - | DependenciesNotLinked String
  - | CyclicDependencies
  - | UnsupportedSpecVer Ver
- data ConflictingDep = ConflictingDep (DependencyReason QPN) (PkgComponent QPN) CI
- ana :: (a -> TreeF d c a) -> a -> Tree d c
- cata :: (TreeF d c a -> a) -> Tree d c -> a
- inn :: TreeF d c (Tree d c) -> Tree d c
- innM :: Monad m => TreeF d c (m (Tree d c)) -> m (Tree d c)
- para :: (TreeF d c (a, Tree d c) -> a) -> Tree d c -> a
- trav :: TreeTrav d c a -> Tree d c -> Tree d a
- zeroOrOneChoices :: Tree d c -> Bool
- active :: Tree d c -> Bool
- type TreeTrav d c a = TreeF d c (Tree d a) -> TreeF d a (Tree d a)
- type EndoTreeTrav d c = TreeTrav d c c

# Documentation

data POption Source #

A package option is a package instance with an optional linking annotation

The modular solver has a number of package goals to solve for, and can only pick a single package version for a single goal. In order to allow to install multiple versions of the same package as part of a single solution the solver uses qualified goals. For example, `0.P` and `1.P` might both be qualified goals for `P`, allowing to pick a difference version of package `P` for `0.P` and `1.P`.

Linking is an essential part of this story. In addition to picking a specific version for `1.P`, the solver can also decide to link `1.P` to `0.P` (or vice versa). It means that `1.P` and `0.P` really must be the very same package (and hence must have the same build time configuration, and their dependencies must also be the exact same).

See http://www.well-typed.com/blog/2015/03/qualified-goals/ for details.

Constructors

POption I (Maybe PackagePath) |

#### Instances

Instances details

Show POption Source # |
Instance details Defined in Distribution.Solver.Modular.Tree Methods showsPrec :: Int -> POption -> ShowS Source # show :: POption -> String Source # showList :: [POption] -> ShowS Source #
Eq POption Source # |
Instance details Defined in Distribution.Solver.Modular.Tree Methods (==) :: POption -> POption -> Bool Source # (/=) :: POption -> POption -> Bool Source #

data Tree d c Source #

Type of the search tree. Inlining the choice nodes for now. Weights on package, flag, and stanza choices control the traversal order.

The tree can hold additional data on `Done` nodes (type `d`) and choice nodes (type `c`). For example, during the final traversal, choice nodes contain the variables that introduced the choices, and `Done` nodes contain the assignments for all variables.

TODO: The weight type should be changed from [Double] to Double to avoid giving too much weight to preferences that are applied later.

Constructors

PChoice QPN RevDepMap c (WeightedPSQ [Weight] POption (Tree d c)) | Choose a version for a package (or choose to link)
FChoice QFN RevDepMap c WeakOrTrivial FlagType Bool (WeightedPSQ [Weight] Bool (Tree d c)) | Choose a value for a flag The Bool is the default value.
SChoice QSN RevDepMap c WeakOrTrivial (WeightedPSQ [Weight] Bool (Tree d c)) | Choose whether or not to enable a stanza

GoalChoice RevDepMap (PSQ (Goal QPN) (Tree d c))

Choose which choice to make next

Invariants:

- PSQ should never be empty
- For each choice we additionally record the `QGoalReason` why we are introducing that goal into tree. Note that most of the time we are working with `Tree QGoalReason`; in that case, we must have the invariant that the `QGoalReason` cached in the `PChoice`, `FChoice` or `SChoice` directly below a `GoalChoice` node must equal the reason recorded on that `GoalChoice` node.

Done RevDepMap d | We're done -- we found a solution!
Fail ConflictSet FailReason | We failed to find a solution in this path through the tree

data TreeF d c a Source #

Functor for the tree type. `a` is the type of nodes' children. `d` and `c` have the same meaning as in `Tree`.

Constructors

PChoiceF QPN RevDepMap c (WeightedPSQ [Weight] POption a) |
FChoiceF QFN RevDepMap c WeakOrTrivial FlagType Bool (WeightedPSQ [Weight] Bool a) |
SChoiceF QSN RevDepMap c WeakOrTrivial (WeightedPSQ [Weight] Bool a) |
GoalChoiceF RevDepMap (PSQ (Goal QPN) a) |
DoneF RevDepMap d |
FailF ConflictSet FailReason |

#### Instances

Instances details

Functor (TreeF d c) Source # |
Instance details Defined in Distribution.Solver.Modular.Tree Methods fmap :: (a -> b) -> TreeF d c a -> TreeF d c b Source # (<$) :: a -> TreeF d c b -> TreeF d c a Source #
Foldable (TreeF d c) Source # |

Instance details

Defined in Distribution.Solver.Modular.Tree

Methods

fold :: Monoid m => TreeF d c m -> m Source #

foldMap :: Monoid m => (a -> m) -> TreeF d c a -> m Source #

foldMap' :: Monoid m => (a -> m) -> TreeF d c a -> m Source #

foldr :: (a -> b -> b) -> b -> TreeF d c a -> b Source #

foldr' :: (a -> b -> b) -> b -> TreeF d c a -> b Source #

foldl :: (b -> a -> b) -> b -> TreeF d c a -> b Source #

foldl' :: (b -> a -> b) -> b -> TreeF d c a -> b Source #

foldr1 :: (a -> a -> a) -> TreeF d c a -> a Source #

foldl1 :: (a -> a -> a) -> TreeF d c a -> a Source #

toList :: TreeF d c a -> [a] Source #

null :: TreeF d c a -> Bool Source #

length :: TreeF d c a -> Int Source #

elem :: Eq a => a -> TreeF d c a -> Bool Source #

maximum :: Ord a => TreeF d c a -> a Source #

minimum :: Ord a => TreeF d c a -> a Source #

sum :: Num a => TreeF d c a -> a Source #

product :: Num a => TreeF d c a -> a Source #

Traversable (TreeF d c) Source # |
Instance details Defined in Distribution.Solver.Modular.Tree Methods traverse :: Applicative f => (a -> f b) -> TreeF d c a -> f (TreeF d c b) Source # sequenceA :: Applicative f => TreeF d c (f a) -> f (TreeF d c a) Source # mapM :: Monad m => (a -> m b) -> TreeF d c a -> m (TreeF d c b) Source # sequence :: Monad m => TreeF d c (m a) -> m (TreeF d c a) Source #

type Weight = Double Source #

data FailReason Source #

Constructors

UnsupportedExtension Extension |
UnsupportedLanguage Language |
MissingPkgconfigPackage PkgconfigName PkgconfigVersionRange |
NewPackageDoesNotMatchExistingConstraint ConflictingDep |
ConflictingConstraints ConflictingDep ConflictingDep |
NewPackageIsMissingRequiredComponent ExposedComponent (DependencyReason QPN) |
NewPackageHasPrivateRequiredComponent ExposedComponent (DependencyReason QPN) |
NewPackageHasUnbuildableRequiredComponent ExposedComponent (DependencyReason QPN) |
PackageRequiresMissingComponent QPN ExposedComponent |
PackageRequiresPrivateComponent QPN ExposedComponent |
PackageRequiresUnbuildableComponent QPN ExposedComponent |
CannotReinstall |
NotExplicit |
Shadowed |
Broken UnitId |
UnknownPackage |
GlobalConstraintVersion VR ConstraintSource |
GlobalConstraintInstalled ConstraintSource |
GlobalConstraintSource ConstraintSource |
GlobalConstraintFlag ConstraintSource |
ManualFlag |
MalformedFlagChoice QFN |
MalformedStanzaChoice QSN |
EmptyGoalChoice |
Backjump |
MultipleInstances |
DependenciesNotLinked String |
CyclicDependencies |
UnsupportedSpecVer Ver |

#### Instances

Instances details

Show FailReason Source # |
Instance details Defined in Distribution.Solver.Modular.Tree Methods showsPrec :: Int -> FailReason -> ShowS Source # show :: FailReason -> String Source # showList :: [FailReason] -> ShowS Source #
Eq FailReason Source # |
Instance details Defined in Distribution.Solver.Modular.Tree Methods (==) :: FailReason -> FailReason -> Bool Source # (/=) :: FailReason -> FailReason -> Bool Source #

data ConflictingDep Source #

Information about a dependency involved in a conflict, for error messages.

Constructors

ConflictingDep (DependencyReason QPN) (PkgComponent QPN) CI |

#### Instances

Instances details

Show ConflictingDep Source # |
Instance details Defined in Distribution.Solver.Modular.Tree Methods showsPrec :: Int -> ConflictingDep -> ShowS Source # show :: ConflictingDep -> String Source # showList :: [ConflictingDep] -> ShowS Source #
Eq ConflictingDep Source # |
Instance details Defined in Distribution.Solver.Modular.Tree Methods (==) :: ConflictingDep -> ConflictingDep -> Bool Source # (/=) :: ConflictingDep -> ConflictingDep -> Bool Source #

ana :: (a -> TreeF d c a) -> a -> Tree d c Source #

Anamorphism on trees.

cata :: (TreeF d c a -> a) -> Tree d c -> a Source #

Catamorphism on trees.

inn :: TreeF d c (Tree d c) -> Tree d c Source #

innM :: Monad m => TreeF d c (m (Tree d c)) -> m (Tree d c) Source #

para :: (TreeF d c (a, Tree d c) -> a) -> Tree d c -> a Source #

Paramorphism on trees.

trav :: TreeTrav d c a -> Tree d c -> Tree d a Source #

zeroOrOneChoices :: Tree d c -> Bool Source #

Approximates the number of active choices that are available in a node. Note that we count goal choices as having one choice, always.

active :: Tree d c -> Bool Source #

Determines whether a tree is active, i.e., isn't a failure node.

type TreeTrav d c a = TreeF d c (Tree d a) -> TreeF d a (Tree d a) Source #

type EndoTreeTrav d c = TreeTrav d c c Source #