Description
The dependency solver currently only checks whether two dependencies on a package conflict when one of the dependencies is fixed, i.e., the solver has already picked a version or an installed package already depends on it. Here is a comment describing the behavior where it is implemented:
cabal/cabal-install-solver/src/Distribution/Solver/Modular/Validate.hs
Lines 428 to 430 in b34184e
I think that it's worth testing the performance of a more eager algorithm that checks whether each new constraint conflicts with any existing constraint. For example, if A-1 depends on C == 1.2.* and B-1 depends on C == 1.3.*, the solver could backtrack immediately after choosing A-1 and B-1 rather than continuing until it fails to choose a version for C.
The change would affect this case:
cabal/cabal-install-solver/src/Distribution/Solver/Modular/Validate.hs
Lines 472 to 478 in b34184e
Possible benefits:
- Improve performance by allowing the solver to backtrack sooner.
- Reduce the size of conflict sets by not adding the conflicting dependency (C above) to the conflict set.
- Improve error messages by finding the conflict after fewer log lines.
We would probably also need to add a new constructor to Conflict
to maintain good performance in the case of two conflicting version ranges.
Activity