Search code examples
haskellcabalcabal-sandbox

Dependency conflicts of base in Haskell cabal


There comes up with a problem that cabal's base is conflicted with the dependency in .cabal file, it seems that my base version is too high, so is there a way to downgrade my base package version in the cabal sandbox.

Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: decafc-0.0.0 (user goal)
[__1] next goal: base (dependency of decafc)
[__1] rejecting: base-4.11.1.0/installed-4.1... (conflict: decafc => base>=4.5
&& <=4.9)
[__1] rejecting: 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, decafc)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, decafc
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unrstering the offending packages or
recreating the sandbox.

There is another problem that when using stack, how to add some flags to the alex if running stack build, for example, the cabal instruction is cabal install --alex-options="--ghc --template=\"$TOP/alex\"". So how to let the stack do the same things?


Solution

  • The base dependency indicates that it only works with versions between 4.5 and 4.9. That means the latest GHC you can use this package with is 8.0.1, since base ships with GHC and can't be upgraded. You could bump the dependency yourself, but you would likely have to fix things that don't work anymore due to changes in base, or you could install an older version of GHC.