Skip to content

Constraint from non-upgradeable package requires installed instance #7918

@LiraOnGithub

Description

@LiraOnGithub

Describe the bug
Setting the constraint of base to a different version than the one already installed results in a constraint from non-upgradeable package requires installed instance.
I have base-4.16 installed, but need base-4.15 as the package memory has a constraint base <4.16.

I made a minimal example to show it.
To Reproduce
Steps to reproduce the behavior:

$ cat test.cabal
name:                test
version:             1.0
build-type:          Simple
cabal-version:       >=1.10
executable test
  main-is:             ./Main.hs
  build-depends:       base <4.16
  hs-source-dirs:      ./
  default-language:    Haskell2010

$ cat Main.hs
module Main where

main = putStrLn "Test"

$ cabal v2-build
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: test-1.0 (user goal)
[__1] next goal: base (dependency of test)
[__1] rejecting: base-4.16.0.0/installed-4.16.0.0 (conflict: test =>
base<4.16)
[__1] skipping: base-4.16.0.0 (has the same characteristics that caused the
previous version to fail: excluded by constraint '<4.16' from 'test')
[__1] rejecting: base-4.15.1.0, base-4.15.0.0, base-4.14.3.0, base-4.14.2.0,
base-4.14.1.0, base-4.14.0.0, base-4.13.0.0, base-4.12.0.0, base-4.11.1.0,
base-4.11.0.0, base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, base-4.9.0.0,
base-4.8.2.0, base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1,
base-4.7.0.0, base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0,
base-4.4.1.0, base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2,
base-4.2.0.1, base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2,
base-3.0.3.1 (constraint from non-upgradeable package requires installed
instance)
[__1] fail (backjumping, conflict set: base, test)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, test

Please use version-prefixed commands (e.g. v2-build or v1-build) to avoid ambiguity.

Expected behavior
Package base to be loaded in a version below 4.16.

System information

  • Ubuntu 20.04.3 LTS 64bit
  • Cabal 3.6.2.0 and ghc 9.2.1

Additional context
The package with the base<4.16-constraint: https://hackage.haskell.org/package/memory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions