haskell / haskell/cabal

Improve the error message when integer-gmp is not installed

Open
#4,285 3 comments 0 reactions 0 assignees View on GitHub
cabal-install: solver type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

This came up at $WORK. My colleague upgraded GHC and then got the following error when trying to install `shake`:

```
$ cabal sandbox init
[...]
$ cabal install shake
Warning: The package list for 'scrive-hackage' is 69 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: base-4.9.1.0/installed-4.9... (dependency of shake-0.15.11)
trying: text-1.2.2.1:-integer-simple
next goal: integer-gmp (dependency of text-1.2.2.1:-integer-simple)
rejecting: integer-gmp-1.0.0.1 (only already installed instances can be used)
rejecting: integer-gmp-1.0.0.0 (conflict: base =>
ghc-prim==0.5.0.0/installed-0.5..., integer-gmp => ghc-prim==0.4.*)
rejecting: integer-gmp-0.5.1.0 (conflict: base =>
ghc-prim==0.5.0.0/installed-0.5..., integer-gmp => ghc-prim>=0.3.1 && <0.4)
Dependency tree exhaustively searched.
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.0.2

$ cabal --version
cabal-install version 1.24.0.0
compiled using version 1.24.0.0 of the Cabal library
```

The root cause of the error is that his GHC was configured not to use GMP, so `integer-simple` was installed instead of `integer-gmp`. It's however not very obvious from the output and there is a lot of noise about conflicts: maybe we can do something smarter in the case when a library that is not installed is being rejected due to the fact that only installed instances can be used.

I don't know, by the way, why the solver didn't pick `text:+integer-simple`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.