solver: Interaction of independent-goals and constraints is not clear
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
It would be worthwhile to improve the documentation about how `independent-goals` is supposed to interact with user specified constraints in a cabal.project or given on the command line.
For example if I have a package `A` which depends on `B`, if I give the solver the goal `A` and enable `--independent-goals` should a constraint `--constraint= B == 2` apply inside the independent goal of `A`?
Reasons to consider:
* The constraint does not apply inside other qualified contexts (for example, setup stanzas), so why does it apply inside a qualified goal.
* If you want a constraint to apply within ALL goals then you can already write `any.A` rather than simply `A`.
* The goal of `A` is supposed to be solved "indepedently" of the rest of the goals/context, this constraint is applied at a global rather than per-goal level.
Therefore it seems like a bug to me that the constraint affects the solver when deciding which version of `B` to pick when solving the independent goal for `A`.
cc @grayjay
This situation is witnessed by this test, the result is `A == 1, B == 2`.
```
testIndepGoals8 :: String -> SolverTest
testIndepGoals8 name =
constraints [ExVersionConstraint (scopeTopLevel "B") (V.thisVersion (V.mkVersion [2,0,0]))] $
independentGoals $
mkTest db name ["A"] $
solverSuccess [("A", 1), ("B", 1)]
where
db :: ExampleDb
db =
[ Right $ exAv "A" 1 [ExAny "B"]
, Right $ exAv "B" 1 []
, Right $ exAv "B" 2 []
, Right $ exAv "B" 3 []
]
```
Contributor guide
Research direction
Start by reading the testIndepGoals8 solver test and tracing how its constraint and independentGoals setup is interpreted. Review the existing Cabal solver documentation and related tests, then document the agreed interaction between independent goals and user constraints; done means the behavior is unambiguous and the example or test reflects it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100