elm-lang / elm-package

Command line tool to share Elm libraries
BSD 3-Clause "New" or "Revised" License
214 stars 66 forks source link

Show reason for dependency conflict #119

Closed JustusAdam closed 8 years ago

JustusAdam commented 9 years ago

Current situation

If your projects has dependencies with internal version conflicts, like

{( p₂ | 1.0.0 ≤ v < 2.0), ( p₃ | 1.0.0 ≤ v < 2.0)} ⇒ p₁ ⋏ {( p₂ | 2.0.0 ≤ v < 3.0.0)} ⇒ p₃

The error message thrown when trying to install p₁ is just

Error: Unable to find a set of packages that will work with your constraints.

The problem

This requires manual dependency tracing to find the offending package(s) which, for even marginally larger projects, can be very laborious.

Solution?

Since the package manager resolves and tests the constraints anyway why not have him spit out whatever the last and final encountered conflict was? Preferably with a resolution trace attached, sort of like cabal does it.

I imagine something like this:

Error: Unable to find a set of packages that will work with your constraints.

tried resolving dependencies for: p₁
tried resolving dependencies for: p₃
encountered conflict with p₂ : 
     p₁ requires version [1.0.0  2.0.0)
     p₃ requires version [2.0.0  3.0.0) 

Or similar.

It does not matter whether this is the actual offending package (in the sense of being the one that needs fixing) but it gives you a start of where to look for the conflicts origin.

jessitron commented 9 years ago

+1 I hit this too, and the message didn't give me a clear picture of what to do about it.

evancz commented 8 years ago

Check out the improvements shown in https://github.com/elm-lang/elm-package/pull/177#issuecomment-222916014.

The particular suggestion given here is likely to say relatively crazy things. Search goes from latest versions to oldest versions, so the final clash is likely to be not very relevant to what you want. In other words, I agree that this is a problem, but I do not see the overall idea here working just based on the prose description.

So I will close this one. Once it is possible to use the new error messages, keep your eyes open for stuff it does poorly on. If you find something, please open a new issue with an http://sscce.org/ showing the exact elm-package.json and the bad message. (Ideally lets not get into abstract discussion of possible improvements. It is better to get examples and work from there.)