Being advertised as a breakthrough in Haskell tooling, I tried switching from Cabal to Stack. However, I still have a problem getting projects to run with stack that run with cabal. I believe the issue is that there are global constraints set by the resolver (e.g. long term support packages from stackage) that don't comply with local package dependencies.
For a concrete example, I used the snap framework (http://snapframework.com/) in version 0.14.0.6. After creating a full snap project with snap init
, I tried to instantiate a stack build plan from the cabal file with stack init
. However, there was no build plan found by stack that satisfies the constraints.
On the other hand, a cabal install
successfully builds the project.
Is there a mistake in my understanding of stack? How can one resolve this issue?
The complete error log is show below, where the project's name is SnapFull:
Checking against build plan lts-3.7
* Build plan did not match your requirements:
base version 4.8.1.0 found
- SnapFull requires >=4 && <4.4
lens version 4.12.3 found
- SnapFull requires >=3.7.6 && <3.8
snap-loader-dynamic not found
- SnapFull requires ==0.10.*
snap-loader-static not found
- SnapFull requires >=0.9 && <0.10
Checking against build plan lts-2.22
* Build plan did not match your requirements:
base version 4.7.0.2 found
- SnapFull requires >=4 && <4.4
lens version 4.7.0.1 found
- SnapFull requires >=3.7.6 && <3.8
snap-loader-dynamic not found
- SnapFull requires ==0.10.*
snap-loader-static not found
- SnapFull requires >=0.9 && <0.10
Checking against build plan lts-3.8
* Build plan did not match your requirements:
base version 4.8.1.0 found
- SnapFull requires >=4 && <4.4
lens version 4.12.3 found
- SnapFull requires >=3.7.6 && <3.8
snap-loader-dynamic not found
- SnapFull requires ==0.10.*
snap-loader-static not found
- SnapFull requires >=0.9 && <0.10
Checking against build plan nightly-2015-10-09
* Build plan did not match your requirements:
base version 4.8.1.0 found
- SnapFull requires >=4 && <4.4
lens version 4.12.3 found
- SnapFull requires >=3.7.6 && <3.8
snap-loader-dynamic not found
- SnapFull requires ==0.10.*
snap-loader-static not found
- SnapFull requires >=0.9 && <0.10
There was no snapshot found that matched the package bounds in your .cabal files.
Please choose one of the following commands to get started.
stack init --resolver lts-3.7
stack init --resolver lts-2.22
stack init --resolver lts-3.8
stack init --resolver nightly-2015-10-09
You'll then need to add some extra-deps. See:
https://github.com/commercialhaskell/stack/blob/master/doc/yaml_configuration.md#extra-deps
You can also try falling back to a dependency solver with:
stack init --solver
stack init --resolver
and then addingextra-deps
? Or usingstack init --solver
? Because Stack, by default, uses of sets of package versions that are known to work together (known as "Stackage snapshots"), there are combinations of packages that do work that it does not know about. You can override those usingextra-deps
. - Emanuel Borsboom