commercialhaskell / commercialhaskell/stack

allow-newer should be suggested more often.

Open
#5,086 0 comments 0 reactions 0 assignees View on GitHub
component: build component: output (UI/UX) type: discuss
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

When trying to switch from LTS to nightly, with this in my `stack.yaml` (among other unimportant things),

```
extra-deps:
- map-syntax-0.3@sha256:84dc86fa1c292af25963bf7212ae7d55ce87239a9f8d4cc85bd0acc35874d2e1
```

I got this:

```
Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for map-syntax-0.3:
base-4.13.0.0 from stack configuration does not match >=4.3 && <4.13 (latest matching version is 4.12.0.0)
needed due to test3-0.0.0 -> map-syntax-0.3

In the dependencies for test3-0.0.0:
chronos needed, but the stack configuration has no specified version (latest matching version is 1.0.9)
string-interpolate needed, but the stack configuration has no specified version (latest matching version
is 0.1.0.1)
needed since test3 is a build target.

Some different approaches to resolving this:

* Build requires unattainable version of base. Since base is a part of GHC, you most likely need to use a
different GHC version with the matching base.

Plan construction failed.
```

The `base` bound is conservative, and the package compiles fine with 4.13. So by using `allow-newer: true` and adding the missing (from nightly) packages to `extra-deps` I was able to build without difficulty.

However, the advice does not suggest this, instead signalling hopelessness. If I understand the Stack code, `extra-deps` is not suggested if `base` is one of the problematic deps, and `allow-newer` is only suggested if it would fix _all_ the problems, which it won't because some `extra-deps` are needed. This creates a recommendation stalemate when in fact the solution was simple.

So I'm thinking `allow-newer` can be suggested even if it would not solve all problems. Or, perhaps it can be mentioned as an option in that "unattainable base" warning.

(Tangentially, it might be nice to be able to specify `allow-newer` on a per-dependency basis, but maybe that would be too troublesome.)

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.