You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ls dependencies --tree fails when targets are provided #4552
I've built a stack from the git master and tried to test the thing.
Steps to reproduce
$ stack ls dependencies aeson --tree
Expected
Dependency tree for aeson package.
Actual
Packages
Map.!: given key is not an element in the map
CallStack (from HasCallStack):
error, called at libraries/containers/Data/Map/Internal.hs:610:17 in containers-0.6.0.1:Data.Map.Internal
Stack version
$ stack --version
Version 1.10.0 (6854 commits) x86_64 hpack-0.31.1
The correct behaviour is not defined anywhere. Having investigated (not on master): without --tree, it only lists dependencies of the target. However, if run outside a project, the command will list nothing — and will error if there's no target.
@wiz can you please check (and post) the outputs of the following variants?
With and without --tree,
In and not in a project directory (i.e. a directory with a stack.yaml in it, or an ancestor, directory), and
The new code for --tree wasn't respecting targets passed to the command, I've fixed that. I should also not have used the unsafe Map.!, I will refactor that and PR soon.
There still remains a couple of problems which I discovered while experimenting:
ls dependencies doesn't fail or produce any output when called with a target while running outside a project.
ls dependencies doesn't fail or produce any output when called with target in a project, but the target doesn't exist in packages in stack.yaml, even if it is a dependency of the project.
--tree flag causes error in both of above scenarios because of Map.!, which hopefully would not be an issue after I deal with it.
We should probably define behaviour in these situations and implement that, if not at least stack should produce an error.
For me: If we call stack build TARGET outside of a project, stack builds the targets. So I'd argue stack ls dependencies TARGET ought to display the dependencies of the target… but as it would be good for ls dependencies not to need network access, I would rather see it fail (gracefully) if this is not possible.
Activity
mattaudesse commentedon Feb 3, 2019
Thanks for reporting this @wiz
dbaynard commentedon Feb 4, 2019
The correct behaviour is not defined anywhere. Having investigated (not on master): without
--tree, it only lists dependencies of the target. However, if run outside a project, the command will list nothing — and will error if there's no target.@wiz can you please check (and post) the outputs of the following variants?
--tree,stack.yamlin it, or an ancestor, directory), and(i.e. 8 commands)
The PRs introducing
--treeare #4339, #4413. @akshaymankar can you take a look?Respect dotTargets in `ls dependencies --tree`
akshaymankar commentedon Feb 4, 2019
The new code for
--treewasn't respecting targets passed to the command, I've fixed that. I should also not have used the unsafeMap.!, I will refactor that and PR soon.There still remains a couple of problems which I discovered while experimenting:
ls dependenciesdoesn't fail or produce any output when called with a target while running outside a project.ls dependenciesdoesn't fail or produce any output when called with target in a project, but the target doesn't exist inpackagesinstack.yaml, even if it is a dependency of the project.--treeflag causes error in both of above scenarios because ofMap.!, which hopefully would not be an issue after I deal with it.We should probably define behaviour in these situations and implement that, if not at least stack should produce an error.
Replace Map.! with Map.lookup
dbaynard commentedon Feb 5, 2019
I'd like to hear @wiz's thoughts.
For me: If we call
stack build TARGEToutside of a project, stack builds the targets. So I'd arguestack ls dependencies TARGETought to display the dependencies of the target… but as it would be good forls dependenciesnot to need network access, I would rather see it fail (gracefully) if this is not possible.@borsboom is probably the person to ask, here.
Respect dotTargets in `ls dependencies --tree`
Replace Map.! with Map.lookup
dpwiz commentedon Feb 7, 2019
@dbaynard Sorry for the delay. I collected the outputs you've mentioned: https://gist.github.com/wiz/94a9613005c4835416dbaf0aaf87ed67
dpwiz commentedon Feb 7, 2019
On a related note,
--treeignores the--pruneoption.dpwiz commentedon Feb 7, 2019
It appears I tried to use
ls dependenciesfor something it wasn't designed for - exploring dependencies of targets, not the stack project as a whole 🤔dbaynard commentedon Feb 7, 2019
Thanks, @wiz. That's helpful (I like how you found some more bugs in the process).
So you ran this from the
stacksource directory?We should fix that, too.
To be fair, it should be clear in the documentation. Thanks for pointing this out.
dpwiz commentedon Feb 7, 2019
Yep, in a project directory.
stack new,cd, add aeson dependency, runls.