You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dependency solver always avoids choosing multiple instances for the same package and version within an install plan, even though that restriction isn't necessary with v2-build.
The constraint is enforced in a separate tree transformation:
-- From the solver's perspective, this means that for any package instance
-- (that is, package name + package version) there can be at most one qualified
-- goal resolving to that instance (there may be other goals _linking_ to that
-- instance however).
enforceSingleInstanceRestriction::Treedc->Treedc
Removing the single instance restriction has several benefits:
It would make it easier for cabal to find a solution. See Why does this need a Cabal constraint? #4192 for an example where the single instance restriction caused more backtracking.
It might improve reuse of packages across install plans by not causing the solver to pick a less preferred version simply because the preferrred version was already used within the install plan.
One disadvantage of removing the single instance restriction is that it would complicate the install plan by making it so that an instance is no longer uniquely identified by its package name and version. We might need to add more information when logging the install plan or errors.
Removing the single instance restriction requires improving the code that converts the solver's install plan to the install plan used by new-build, such as this TODO:
I'm not sure I follow, it's the case that solver does pick different versions for packages already, e.g. even building cabal project, we have local Cabal-3.3, and Cabal-3.0.0.0 somewhere for build-type: Custom.
Or is there a restriction that all qualified goals would pick the same Cabal-3.0.0.0 now? (if it's so, it feels silly IMHO, it thought that solver prefers to pick the same, but isn't required to do so)
EDIT: or do you mean, that there might be Cabal-3.0.0.0 and Cabal-3.2.0.0 in setup-depends, but all the Cabal-3.0.0.0 are the same? Hmm. I maybe start to understand what's happening.
Yes, the solver just forces Cabal-3.0.0.0 under all qualifiers to be the same instance (have the same version and exactly the same dependencies), so that Cabal-3.0.0.0 is only built once.
The dependency solver always avoids choosing multiple instances for the same package and version within an install plan, even though that restriction isn't necessary with v2-build.
The constraint is enforced in a separate tree transformation:
cabal/cabal-install/Distribution/Solver/Modular/Preference.hs
Lines 450 to 456 in 7fd2f60
Removing the single instance restriction has several benefits:
new-build
dependency resolution performance problems with custom builds #6309.new-build
dependency resolution performance problems with custom builds #6309 (comment) shows thatenforceSingleInstanceRestriction
took 4.5% of the time.One disadvantage of removing the single instance restriction is that it would complicate the install plan by making it so that an instance is no longer uniquely identified by its package name and version. We might need to add more information when logging the install plan or errors.
Removing the single instance restriction requires improving the code that converts the solver's install plan to the install plan used by new-build, such as this TODO:
cabal/cabal-install/Distribution/Solver/Modular/Assignment.hs
Lines 41 to 47 in 7fd2f60
The text was updated successfully, but these errors were encountered: