Upgrading packages installed in a cabal sandbox

1.1k Views Asked by At

I'm having some trouble understanding how to upgrade packages inside a cabal sandbox. I'd like to upgrade esqueleto-1.3.4.5 to esqueleto-1.3.5 and changed my myapp.cabal to depend on esqueleto >= 1.3.5 && < 1.4.

$ cabal --version cabal-install version 1.18.0.2 using version 1.18.1.2 of the Cabal library $ cabal install --upgrade-dependencies Resolving dependencies... cabal: Could not resolve dependencies: trying: esqueleto-1.3.4.5/installed-ac7... (user goal) next goal: myapp (user goal) rejecting: myapp-0.0.0 (conflict: esqueleto==1.3.4.5/installed-ac7..., myapp => esqueleto>=1.3.5 && <1.4)

The error looks to me as if cabal is trying to resolve dependencies using the installed version of esqueleto, esqueleto-1.3.4.5/installed-ac7... Could someone explain how this works?

My intuition was that I should use --upgrade-dependencies to do this but I also tried --only-dependencies and --reinstall.

1

There are 1 best solutions below

1
bheklilr On

The easiest way I've found is to just nuke your sandbox and start over

$ cabal sandbox delete
$ cabal sandbox init
$ cabal install --only-dependencies

You can alternatively delete the specific package from the .cabal-sandbox/<platform>/ and .cabal-sandbox/<platform>-packages.conf/ folders, but that requires a bit more "surgery". Unless your dependencies are just massive and you need to do this frequently, the nuclear option isn't too annoying.