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

cabal v2-install UX is not pleasant #6119

Closed
mitchellwrosen opened this issue Jun 28, 2019 · 4 comments
Closed

cabal v2-install UX is not pleasant #6119

mitchellwrosen opened this issue Jun 28, 2019 · 4 comments

Comments

@mitchellwrosen
Copy link

Apologies if this is a duplicate ticket, but I hunted around a bit and did not find anything.

The cabal v2-install experience is not very pleasant right now. Here is me trying to install hlint-2.2 from hackage:

> cabal unpack hlint
> cd hlint-2.2

Ok so far.

> cabal v2-install
Resolving dependencies...
Assertion failed
CallStack (from HasCallStack):
  assert, called at ./Distribution/Client/ProjectOrchestration.hs:796:5 in main:Distribution.Client.ProjectOrchestration

??? Baffling. I could try saying more to the tool but I feel I've said it all.

> cabal v2-install hlint
cabal: Ambiguous target 'hlint'. It could be:
exe:hlint (component)
lib:hlint (component)

So I have to specify that I want to install the executable, not the library? I thought install was only for building executables.

> cabal v2-install hlint:exe:hlint
...
cabal: Path '/home/mitchell/.local/bin/hlint' already exists. Use --overwrite-policy=always to overwrite.

Ok... not a bad default I suppose, but I was unable to figure out the .cabal/config syntax for this option. overwrite-policy = always doesn't work.

> cabal v2-install hlint:exe:hlint --overwrite-policy=always

Works, but takes a couple seconds. Kind of annoying after just running without the last --overwrite-policy=always, it feels like this should not have to do any more work.

@gbaz
Copy link
Collaborator

gbaz commented Jun 28, 2019

I'm not seeing the HasCallStack error in cabal -- perhaps you're not on the latest version?

As for the second question -- v2 install works on libs too, building them into the store and updating the global env file to include them. However, testing the cabal v2-install in a local directory (which does work with latest cabal) does not give me the helpful "ambiguous target" error but just seems to think there is no target if I don't specify -- so that could be improved.

We could also certainly improve the documentation in cabal-config to make clear where overwrite-policy goes... (testing init of a fresh user-config file it looks like it isn't even inserted commented-out to indicate the right location).

@mitchellwrosen
Copy link
Author

I'm not seeing the HasCallStack error in cabal -- perhaps you're not on the latest version?

Oops, I was using some version of cabal-install built from source, between 2.4 and 3.0. So apologies, that's not an issue, though oddly the very latest cabal-install can't build hlint-2.2 for an entirely different reason:

cabal: Could not resolve dependencies:
[__0] trying: hlint-2.2 (user goal)
[__1] next goal: ghc-lib-parser (dependency of hlint)
[__1] rejecting: ghc-lib-parser-8.8.0.20190424 (conflict: requires
NondecreasingIndentation)
[__1] rejecting: ghc-lib-parser-0.20190603, ghc-lib-parser-0.20190523,
ghc-lib-parser-0.20190516, ghc-lib-parser-0.20190423,
ghc-lib-parser-0.20190402 (conflict: hlint => ghc-lib-parser==8.8.0.20190424)
[__1] fail (backjumping, conflict set: ghc-lib-parser, hlint)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: hlint, ghc-lib-parser

(but that's not relevant to this ticket)

@typedrat
Copy link
Collaborator

This is a dupe of #5978.

@gbaz
Copy link
Collaborator

gbaz commented Jun 28, 2019

I think the other half of the issue, which is the overwrite-policy, is fixed by #5942

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

4 participants