Skip to content

allow-newer should be suggested more often. #5086

Open
@galenhuntington

Description

@galenhuntington

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.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions