Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add why-depends command #51

Open
fendor opened this issue Apr 5, 2020 · 3 comments
Open

[Feature Request] Add why-depends command #51

fendor opened this issue Apr 5, 2020 · 3 comments

Comments

@fendor
Copy link

fendor commented Apr 5, 2020

Similar to nix, add why-depends command, to show why you depend on a package.

Workflow:

$ cabal-plan why-depends exe:foo containers
 └─ foo-1.0
    [foo-1.0:exe:"foo"]
    └─ some-package-2.7.1
       └─ containers-0.6.2.1 ┄┄

If package is multiple times in the dependency closure, every path is shown.

An extension would be to show why this version was chosen.
Some idea for the output format:

$ cabal-plan why-depends exe:foo containers --show-constraints
some-package: containers ^>= 0.6.2.1

Final version constraint:
containers ^>= 0.6.2.1

Chose containers-0.6.2.1

If this feature is a welcome addition to cabal-plan, I would be happy to provide a PR for it.

@hvr
Copy link
Collaborator

hvr commented Apr 5, 2020

If this feature is a welcome addition to cabal-plan, I would be happy to provide a PR for it.

Yes, please! :-)

@hvr hvr added the enhancement label Apr 5, 2020
@fendor
Copy link
Author

fendor commented Apr 10, 2020

I have a design question. Currently, I can produce the following output:

cabal-plan-0.6.2.0
 ├─ aeson-1.4.7.1
 │  ├─ attoparsec-0.13.2.4
 │  │  ├─ containers-0.6.2.1
 │  │  ├─ scientific-0.3.6.2
 │  │  │  ├─ binary-0.8.7.0
 │  │  │  │  └─ containers-0.6.2.1 ┄┄
 │  │  │  ├─ containers-0.6.2.1 ┄┄
 │  │  │  ├─ hashable-1.3.0.0
 │  │  │  │  └─ text-1.2.4.0
 │  │  │  │     └─ binary-0.8.7.0 ┄┄
 │  │  │  └─ text-1.2.4.0 ┄┄
 │  │  └─ text-1.2.4.0 ┄┄
 │  ├─ containers-0.6.2.1 ┄┄
 │  ├─ hashable-1.3.0.0 ┄┄
 │  ├─ scientific-0.3.6.2 ┄┄
 │  ├─ text-1.2.4.0 ┄┄
 │  ├─ th-abstraction-0.3.2.0
 │  │  └─ containers-0.6.2.1 ┄┄
 │  ├─ unordered-containers-0.2.10.0
 │  │  └─ hashable-1.3.0.0 ┄┄
 │  └─ uuid-types-1.0.3
 │     ├─ binary-0.8.7.0 ┄┄
 │     ├─ hashable-1.3.0.0 ┄┄
 │     └─ text-1.2.4.0 ┄┄
 ├─ containers-0.6.2.1 ┄┄
 └─ text-1.2.4.0 ┄┄

for lib:cabal-plan and I asked why it depends on containers.
I re-use the logic from cabal-plan info, in particular from dumpPlanJson.

The logic avoids re-printing units that have already been printed. Is that nice UX?

@phadej
Copy link
Collaborator

phadej commented Apr 10, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants