Skip to content
This repository was archived by the owner on Aug 23, 2018. It is now read-only.

Add --verbose arg and show how package dependency is being solved #177

Closed
wants to merge 5 commits into from
Closed

Add --verbose arg and show how package dependency is being solved #177

wants to merge 5 commits into from

Conversation

ento
Copy link

@ento ento commented Nov 23, 2015

Motivation

Sometimes why elm-package is "unable to find a set of packages that will work with your constraints" is pretty nebulous. While not the most friendly interface, adding verbose logging will help diagnosing the problem by hands and eyes.

Changes

  • Added hslogger for logging
  • Added a --verbose argument
  • Added logging to various places in Solver

This is my first Haskell code ever, so if something's not quite right, then it's most likely unintentional. Also I'm not familiar with the internals of Solver, so the way I phrased the logs may not be accurate.

Output sample

For elm-package.json found in #176:

evancz/start-app = 2.0.2
elm-lang/core = 3.0.0
evancz/elm-svg = 2.0.1
mgold/Elm-Random-Sampling = 2.0.3
evancz/elm-html = 4.0.2
evancz/elm-html = 4.0.2 depends on evancz/virtual-dom: 2.0.0 <= v < 3.0.0
evancz/virtual-dom = 2.1.0, 2.0.0
evancz/elm-svg = 2.0.1 depends on evancz/virtual-dom: 1.2.0 <= v < 3.0.0
evancz/virtual-dom = 2.1.0, 2.0.0, 1.2.3, 1.2.2, 1.2.1, 1.2.0
evancz/start-app = 2.0.2 depends on evancz/elm-effects: 2.0.0 <= v < 3.0.0
evancz/elm-effects = 2.0.1, 2.0.0
mgold/Elm-Random-Sampling = 2.0.3 requires Elm version 0.15.0 <= v < 0.16.0 but we are on 0.16.0
evancz/virtual-dom = 2.0.0 requires Elm version 0.15.0 <= v < 0.16.0 but we are on 0.16.0
evancz/virtual-dom = 1.2.3 requires Elm version 0.15.0 <= v < 0.16.0 but we are on 0.16.0

Error: Unable to get elm-package.json for evancz/virtual-dom 1.2.2
Missing field "elm-version", acceptable versions of the Elm Platform (e.g. "0.16.0 <= v < 0.17.0").
    Check out an example elm-package.json file here:
    <https://raw.githubusercontent.com/evancz/elm-html/master/elm-package.json>

@eeue56
Copy link
Contributor

eeue56 commented Nov 23, 2015

+1, I like it. Only comment would be that adding a verbose flag should be different to displaying the messages - if a package can't be resolved, then it the conflict should always be printed out, regardless of verbosity.

@jvoigtlaender
Copy link
Contributor

This is so cool! It would probably resolve the needs of people over at #119 as well. And maybe also #173. So @evancz, when merging this, the other issues could probably be closed.

@JustusAdam
Copy link

The UI seems a bit hard to read, but it's a start. 👍

@rtfeldman
Copy link

+1 to @eeue56's comment - any time I get a failed dependency resolution, this is exactly what I want to know next, so might as well just tell me right away. 😄

@ento
Copy link
Author

ento commented Jan 24, 2016

Note: this PR breaks elm-make. This patch unbreaks elm-make.

@EnoahNetzach
Copy link

Why isn't this already merged, after more than 5 months?
I just wanted to check elm out, I was so excited because it was "react + redux + haskell".
Now I'm just frustrated because I just installed it from npm and nothing works, and I have no idea how to solve it.

NOT the way to go...

@evancz
Copy link
Contributor

evancz commented Jun 1, 2016

I think this PR points in a good direction (thank you!) but I do not think the approach can really give hints that will be helpful for resolving the issue. Recording the entire search has two major problems:

  1. The search space is very very large. Picking a different version adds constraints, so the problem grows and changes as you solve it.
  2. Having the "search history" makes no recommendation about how to fix anything.

So ultimately, this would mean that users get very long dumps of information that do not make any constructive recommendations. It will just say "we tried everything" but for a really long time. I believe the search space is exponential (or at least very bad) in the number of constraints, so this gets out of control in any larger scenario.

Towards hints

I used this PR as motivation for "better hints" though, and I just got done taking a first pass. Given this bad elm-package.json, the latest version produces the following message:

screen shot 2016-06-01 at 12 26 13 am

Targeted suggestions that will help the user take the next steps. So I think the root motivation of this PR is coming through, but must take a different form to get to the heart of things.

This approach also gives better hints for the particular scenario you showed in the original comment. I show it in #176 (comment)

@evancz evancz closed this Jun 1, 2016
@elm-lang elm-lang locked and limited conversation to collaborators Jun 3, 2016
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants