1
+ synopsis: Override imported package version equalities
2
+ description:
3
+ This change enables a project to take constraints from stackage without having
4
+ to download and comment out conflicting version equality constraints where we
5
+ might prefer a different version of a package than the resolver has.
6
+
7
+ Stackage provides a `/cabal.config` for any resolver, such as
8
+ [nightly-2023-12-07/cabal.config](https://www.stackage.org/nightly-2023-12-07/cabal.config).
9
+ This is made up mostly of exact versions of packages, stipulated as version
10
+ equality constraints. For any package in the resolver where we want a
11
+ different version we're stuck as we can't add a new equality constraint for
12
+ a package without creating a constraint set that is impossible to solve. We
13
+ can't solve for two versions of the same package.
14
+
15
+ ```
16
+ -- cabal.project
17
+ constraints: hashable ==1.4.3.0
18
+ constraints: hashable ==1.4.2.0
19
+ ```
20
+
21
+ This change gives priority to version equality constraints that are less
22
+ imported and does so by only passing along the top priority constraints (the
23
+ least imported for any package) to the solver. The lower priority version
24
+ equality constraints are discarded. If `nightly-2023-12-07` has `constraints:
25
+ hashable ==1.4.3.0` then this fix will effectively allow the local
26
+ `cabal.project` to override that version and pick another.
27
+
28
+ ```
29
+ -- cabal.project
30
+ import: https://www.stackage.org/nightly-2023-12-07/cabal.config
31
+ constraints: hashable ==1.4.2.0
32
+ ```
33
+
34
+ The order of the import relative to the constraints does not matter within a
35
+ project because the project is at the root of the import tree. Anything put
36
+ there is top priority.
37
+
38
+ The same relative precedence rule applies per-package down an import tree for
39
+ more complex import situations. Other constraints, such as flags, are not
40
+ touched by this fix so it may be possible to orphan some flags that relate to
41
+ versions of packages that get weeded out.
42
+
43
+ packages: cabal-install
44
+ prs: #9510
45
+ issues: #9511
0 commit comments