The recent Travis CI build of the development version of my Haskell package reports the error
MissingH must match >=1.3.0.1, but the stack configuration has no specified version (latest matching version is 1.4.0.1)
when building for GHC 8.6.1, even though I have
MissingH >=1.3.0.1
in my build-depends
.
I don't understand this error: it seems contradictory. I have no upper limit on MissingH, so why is it erroring and not using the latest?
You need to add
MissingH
tostack.yaml
.Your package's
*.cabal
file says what versions of dependencies are compatible with your package. It is a loose specification, not all combinations may actually work (because they may have conflicting bounds on transitive dependencies, or there is some unforeseen breakage with a particular version you haven't tested with).In contrast,
stack.yaml
describes a particular snapshot of packages, pinned to specific versions. This precisely says "my package is known to work with those versions". Of course, it is tedious to maintain the version of every dependency, and for that the Stackage team maintains a "resolver", a curated set of package versions known to work together, that you can use to specify the version of many packages at once, by setting theresolver:
field ofstack.yaml
appropriately. A resolver only lists a subset of packages on Hackage, so when one of your dependencies is not in there, you need to add it to yourstack.yaml
as anextra-dep
.Update: following the discussion, some more details about configuring travis are necessary.
First, my current preferred solution for CI of Haskell projects is to not bother with stack and use instead https://github.com/haskell-CI/haskell-ci which generates a travis script using cabal-install.
Now for a less radical solution.
Currently the travis script is only varying the
--resolver
option, but as far as I can tell there is no command line option to add an extra-dep. It seemsstack.yaml
files are the only way for that. Furthermore, we only want to specifyMissingH
as an extra-dep for the latest nightlies, because LTS'es already include it.Thus I suggest the following:
Create a separate
stack.yaml
for the nightly resolver only, call it something else since you already have one, for examplestack-nightly.yaml
Set an environment variable to point to
stack-nightly.yaml
when the resolver is a nightly, maybe:Otherwise you can use the
--stack-yaml
command line option.