stack install ghc-mod fails to construct build plan - haskell

I've been trying to install ghc-mod locally within a Stack project.
However, whenever I try to stack build ghc-mod, I get a build plan failure like the following:
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for ghc-mod-5.8.0.0:
cabal-helper must match <0.8 && >=0.7.3.0, but the stack configuration has no specified
version (latest matching version is 0.7.3.0)
djinn-ghc must match <0.1 && >=0.0.2.2, but the stack configuration has no specified version
(latest matching version is 0.0.2.3)
extra must match <1.6 && >=1.4, but the stack configuration has no specified version (latest
matching version is 1.5.3)
fclabels must match ==2.0.*, but the stack configuration has no specified version (latest
matching version is 2.0.3.3)
ghc-paths must match <0.2 && >=0.1.0.9, but the stack configuration has no specified version
(latest matching version is 0.1.0.9)
ghc-syb-utils must match <0.3 && >=0.2.3, but the stack configuration has no specified
version (latest matching version is 0.2.3.3)
haskell-src-exts must match <1.20 && >=1.18, but the stack configuration has no specified
version (latest matching version is 1.19.1)
hlint must match <2.1 && >=2.0.8, but the stack configuration has no specified version
(latest matching version is 2.0.15)
monad-control must match >=1 && <1.1, but the stack configuration has no specified version
(latest matching version is 1.0.2.3)
monad-journal must match <0.8 && >=0.4, but the stack configuration has no specified version
(latest matching version is 0.7.2)
mtl needed, but the stack configuration has no specified version (latest matching version
is 2.2.2)
old-time needed, but the stack configuration has no specified version (latest matching
version is 1.1.0.3)
optparse-applicative must match >=0.13.0.0 && <0.14, but the stack configuration has no
specified version (latest matching version is 0.13.2.0)
pipes must match <4.4 && >=4.1, but the stack configuration has no specified version (latest
matching version is 4.3.9)
safe must match <0.4 && >=0.3.9, but the stack configuration has no specified version
(latest matching version is 0.3.17)
semigroups must match >=0.10.0 && <0.19, but the stack configuration has no specified
version (latest matching version is 0.18.5)
split must match >=0.2.2 && <0.3, but the stack configuration has no specified version
(latest matching version is 0.2.3.3)
syb must match <0.8 && >=0.5.1, but the stack configuration has no specified version (latest
matching version is 0.7)
temporary must match <1.3 && >=1.2.0.3, but the stack configuration has no specified version
(latest matching version is 1.2.1.1)
text must match <1.3 && >=1.2.1.3, but the stack configuration has no specified version
(latest matching version is 1.2.3.0)
transformers-base must match <0.5 && >=0.4.4, but the stack configuration has no specified
version (latest matching version is 0.4.5.2)
needed since ghc-mod is a build target.
If I follow the warning's advice to add the missing dependencies to my stack.yaml's extra-deps key, I just get more recursive errors and eventually a build plan that has a build conflict somewhere that's not obvious to me at least and no helpful clues to resolve it.
Here's the stack.yaml:
flags: {}
packages:
- .
extra-deps:
- cabal-helper-0.7.3.0
- djinn-ghc-0.0.2.3
- extra-1.5.3
- fclabels-2.0.3.3
- ghc-paths-0.1.0.9
- ghc-syb-utils-0.2.3.3
- hlint-2.0.15
- base-4.7.0.2
- StateVar-1.1.1.1
- deepseq-1.3.0.2
- vector-algorithms-0.7.0.4
- monad-control-1.0.2.3
- monad-journal-0.7.2
- mtl-2.2.2
- old-time-1.1.0.3
- optparse-applicative-0.13.2.0
- pipes-4.3.9
- safe-0.3.17
- semigroups-0.18.5
- split-0.2.3.3
- syb-0.7
- temporary-1.2.1.1
- text-1.2.3.0
- transformers-base-0.4.5.2
- aeson-1.4.0.0
- ansi-terminal-0.8.0.4
- ansi-wl-pprint-0.6.8.2
- async-2.2.1
- base-orphans-0.8
- clock-0.7.2
- cmdargs-0.10.20
- cpphs-1.20.8
- data-default-0.7.1.1
- djinn-lib-0.0.1.3
- either-4.4.1.1
- exceptions-0.10.0
- haskell-src-exts-util-0.2.3
- hscolour-1.24.4
- mmorph-1.1.2
- old-locale-1.0.0.7
- refact-0.3.0.2
- stm-2.4.5.0
- transformers-compat-0.6.2
- uniplate-1.6.12
- unordered-containers-0.2.9.0
- utf8-string-1.0.1.1
- vector-0.12.0.1
- void-0.7.2
- yaml-0.10.0
- cabal-doctest-1.0.6
- comonad-5.0.4
- contravariant-1.5
- distributive-0.6
- haskell-src-exts-1.20.2
- integer-logarithms-1.0.2.1
- mono-traversable-1.0.9.0
- prelude-extras-0.4.0.3
- random-1.1
- time-1.4.2
- unliftio-core-0.1.1.0
- MonadRandom-0.5.1.1
- attoparsec-0.13.2.2
- base-compat-0.10.4
- bifunctors-5.5.3
- colour-2.3.4
- conduit-1.3.0.3
- data-default-class-0.1.2.0
- data-default-instances-containers-0.0.1
- data-default-instances-dlist-0.0.1
- data-default-instances-old-locale-0.0.1
- dlist-0.8.0.4
- free-4.12.4
- hashable-1.2.7.0
- polyparse-1.12
- primitive-0.6.4.0
- profunctors-5.3
- resourcet-1.2.1
- scientific-0.3.6.2
- semigroupoids-5.3.1
- tagged-0.8.6
- th-abstraction-0.2.8.0
- time-locale-compat-0.1.1.4
- uuid-types-1.0.3
resolver: ghc-8.0.2
Am I missing something here? Surely this should be easier. I gather ghc-mod isn't supported past GHC 8.2 so I deliberately set up the project with GHC 8.0.2 as verified by running GHCI (not without its own long list of warnings).
I also tried with a 7.x version of GHC and that had the same issues, though with slightly different dependencies.

Related

category-extras needed, but the stack configuration has no specified version

I am writing a small Haskell program which need import two modules Control.Functor.Algebra and Control.Morphism.Hylo.
I searched the google. These two modules can be found in category-extras.
So I added category-extras to package.yaml:
dependencies:
- base >= 4.7 && < 5
- category-extras
Then call stack build, but error occured:
E:\work-category-theory\quick-sort>stack build
Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
Error: While constructing the build plan, the following exceptions were
encountered:
In the dependencies for quick-sort-0.1.0.0:
category-extras needed, but the stack configuration has no specified
version (latest matching version is 1.0.2)
needed since quick-sort is a build target.
Some different approaches to resolving this:
* Recommended action: try adding the following to your extra-deps
in E:\work-category-theory\quick-sort\stack.yaml:
- category-extras-1.0.2#sha256:511a5668e05af6617d94080e866c9a496e0abd7625d961264755614a73b517f1,10259
Plan construction failed.
Following the prompts, I added category-extras-1.0.2#sha256:511a5668e05af6617d94080e866c9a496e0abd7625d961264755614a73b517f1,10259 to the extra-deps in stack.yaml:
extra-deps:
- category-extras-1.0.2#sha256:511a5668e05af6617d94080e866c9a496e0abd7625d961264755614a73b517f1,10259
But still failed:
E:\work-category-theory\quick-sort>stack build
Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for category-extras-1.0.2:
categories needed, but the stack configuration has no specified version (latest matching version is 1.0.7)
comonad-extras needed, but the stack configuration has no specified version (latest matching version is 4.0.1)
comonad-transformers needed, but the stack configuration has no specified version (latest matching version is 4.0)
comonads-fd needed, but the stack configuration has no specified version (latest matching version is 4.0)
groupoids needed, but the stack configuration has no specified version (latest matching version is 4.0)
indexed-extras needed, but the stack configuration has no specified version (latest matching version is 0.2)
profunctor-extras needed, but the stack configuration has no specified version (latest matching version is 4.0)
representable-functors needed, but the stack configuration has no specified version (latest matching version
is 3.2.0.2)
representable-profunctors needed, but the stack configuration has no specified version (latest matching version
is 3.2)
needed due to quick-sort-0.1.0.0 -> category-extras-1.0.2
Some different approaches to resolving this:
* Recommended action: try adding the following to your extra-deps in E:\work-category-theory\quick-sort\stack.yaml:
- categories-1.0.7#sha256:e707f8ac06eac755cb508aa67de64ab2e33ce1c54aebb6f43f64c615aa5234f6,1636
- comonad-extras-4.0.1#sha256:60c93aa274239086d96d162c3c8bf7cde33a3e8470ecb56461b2f77d2625521e,1321
- comonad-transformers-4.0#sha256:cdc81f6837836ec4b120ced8503b54a7f1e230e08971cc01717dcd16ba1ceb28,831
- comonads-fd-4.0#sha256:92ed08f50f64aa9ce57214c9f0539e0244225ef4c934065dff819a751b89eeaf,817
- groupoids-4.0#sha256:7d26a2cc5e557773b565f2433b898d7472404a03bafde51fec5f4a7c7936812e,836
- indexed-extras-0.2#sha256:e7e498023e33016fe45467dfee3c1379862e7e6654a806a965958fa1adc00304,1349
- profunctor-extras-4.0#sha256:b436587378964546df3063dad44504fd698cce0f714ce089c1e3b499f063940d,874
- representable-functors-3.2.0.2#sha256:f15e598ca712171408d919803a48dcf786c94e9596a65336a3d66d0886ca60c5,1877
- representable-profunctors-3.2#sha256:d7d902ab21de5bcf9ceeb1b13529aa835a818dad00e75da999241508f89f85c2,786
Plan construction failed.
Following the prompts, I continue to add extra-deps in stack.yaml:
extra-deps:
- category-extras-1.0.2#sha256:511a5668e05af6617d94080e866c9a496e0abd7625d961264755614a73b517f1,10259
- categories-1.0.7#sha256:e707f8ac06eac755cb508aa67de64ab2e33ce1c54aebb6f43f64c615aa5234f6,1636
- comonad-extras-4.0.1#sha256:60c93aa274239086d96d162c3c8bf7cde33a3e8470ecb56461b2f77d2625521e,1321
- comonad-transformers-4.0#sha256:cdc81f6837836ec4b120ced8503b54a7f1e230e08971cc01717dcd16ba1ceb28,831
- comonads-fd-4.0#sha256:92ed08f50f64aa9ce57214c9f0539e0244225ef4c934065dff819a751b89eeaf,817
- groupoids-4.0#sha256:7d26a2cc5e557773b565f2433b898d7472404a03bafde51fec5f4a7c7936812e,836
- indexed-extras-0.2#sha256:e7e498023e33016fe45467dfee3c1379862e7e6654a806a965958fa1adc00304,1349
- profunctor-extras-4.0#sha256:b436587378964546df3063dad44504fd698cce0f714ce089c1e3b499f063940d,874
- representable-functors-3.2.0.2#sha256:f15e598ca712171408d919803a48dcf786c94e9596a65336a3d66d0886ca60c5,1877
- representable-profunctors-3.2#sha256:d7d902ab21de5bcf9ceeb1b13529aa835a818dad00e75da999241508f89f85c2,786
Failed again:
E:\work-category-theory\quick-sort>stack build
Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for representable-functors-3.2.0.2:
comonad-5.0.6 from stack configuration does not match >=3 && <4 (latest matching version is 3.1)
comonad-transformers-4.0 from stack configuration does not match >=3 && <4 (latest matching version is 3.1)
comonads-fd-4.0 from stack configuration does not match >=3 && <4 (latest matching version is 3.0.3)
containers-0.6.2.1 from stack configuration does not match >=0.3 && <0.6 (latest matching version is 0.5.11.0)
contravariant-1.5.2 from stack configuration does not match >=0.4.1 && <1 (latest matching version is 0.6.1.1)
free-5.1.3 from stack configuration does not match >=3 && <4 (latest matching version is 3.4.2)
mtl-2.2.2 from stack configuration does not match >=2.0.1.0 && <2.2 (latest matching version is 2.1.3.1)
semigroupoids-5.3.4 from stack configuration does not match >=3 && <4 (latest matching version is 3.1)
transformers-0.5.6.2 from stack configuration does not match >=0.2 && <0.4 (latest matching version is 0.3.0.0)
needed due to quick-sort-0.1.0.0 -> representable-functors-3.2.0.2
Some different approaches to resolving this:
* Set 'allow-newer: true' in C:\sr\config.yaml to ignore all version constraints and build anyway.
* Recommended action: try adding the following to your extra-deps in E:\work-category-theory\quick-sort\stack.yaml:
- comonad-3.1#sha256:95ab6440e380de06c6167f52a29903bee3e06295bb15598687305755eb1febd9,1635
- comonad-transformers-3.1#sha256:6641d4d5466a1e5e5b3863654d1df224c0980c332cf648b17ff148312bcf3f3b,1372
- comonads-fd-3.0.3#sha256:7fd04f220367fe8c0cd2b8c35ca15bc77a7d93a3d45f276435a094f9bdb44a60,1376
- containers-0.5.11.0#sha256:28ad7337057442f75bc689315ab4ec7bdf5e6b2c39668f306672cecd82c02798,16685
- contravariant-0.6.1.1#sha256:715c882354db424ed8b79518dab90e103a30a0ac64229f6cc86f0b3bb036c5dc,1493
- free-3.4.2#sha256:ddb52e32cb0e219e7d46b7021c7d1ec54797df878fd1b1ede0732bcacafdd9f0,2262
- mtl-2.1.3.1#sha256:a4283d5070cef5061aa8888c88baf50cd2db1904b254701321a93cf6c0835a11,1618
- semigroupoids-3.1#sha256:66c4375dabc33cff413ab5c1bc73c313fd2768ae21504b1cd1ac9aa8705529dd,3550
- transformers-0.3.0.0#sha256:4ec3dd53be60415dad46e00ec6c7f78bdc37dcda1670cf5abe5c480719b78b60,2318
Plan construction failed.
OK, I continue to add..
- category-extras-1.0.2#sha256:511a5668e05af6617d94080e866c9a496e0abd7625d961264755614a73b517f1,10259
- categories-1.0.7#sha256:e707f8ac06eac755cb508aa67de64ab2e33ce1c54aebb6f43f64c615aa5234f6,1636
- comonad-extras-4.0.1#sha256:60c93aa274239086d96d162c3c8bf7cde33a3e8470ecb56461b2f77d2625521e,1321
- comonad-transformers-4.0#sha256:cdc81f6837836ec4b120ced8503b54a7f1e230e08971cc01717dcd16ba1ceb28,831
- comonads-fd-4.0#sha256:92ed08f50f64aa9ce57214c9f0539e0244225ef4c934065dff819a751b89eeaf,817
- groupoids-4.0#sha256:7d26a2cc5e557773b565f2433b898d7472404a03bafde51fec5f4a7c7936812e,836
- indexed-extras-0.2#sha256:e7e498023e33016fe45467dfee3c1379862e7e6654a806a965958fa1adc00304,1349
- profunctor-extras-4.0#sha256:b436587378964546df3063dad44504fd698cce0f714ce089c1e3b499f063940d,874
- representable-functors-3.2.0.2#sha256:f15e598ca712171408d919803a48dcf786c94e9596a65336a3d66d0886ca60c5,1877
- representable-profunctors-3.2#sha256:d7d902ab21de5bcf9ceeb1b13529aa835a818dad00e75da999241508f89f85c2,786
- comonad-3.1#sha256:95ab6440e380de06c6167f52a29903bee3e06295bb15598687305755eb1febd9,1635
- comonad-transformers-3.1#sha256:6641d4d5466a1e5e5b3863654d1df224c0980c332cf648b17ff148312bcf3f3b,1372
- comonads-fd-3.0.3#sha256:7fd04f220367fe8c0cd2b8c35ca15bc77a7d93a3d45f276435a094f9bdb44a60,1376
- containers-0.5.11.0#sha256:28ad7337057442f75bc689315ab4ec7bdf5e6b2c39668f306672cecd82c02798,16685
- contravariant-0.6.1.1#sha256:715c882354db424ed8b79518dab90e103a30a0ac64229f6cc86f0b3bb036c5dc,1493
- free-3.4.2#sha256:ddb52e32cb0e219e7d46b7021c7d1ec54797df878fd1b1ede0732bcacafdd9f0,2262
- mtl-2.1.3.1#sha256:a4283d5070cef5061aa8888c88baf50cd2db1904b254701321a93cf6c0835a11,1618
- semigroupoids-3.1#sha256:66c4375dabc33cff413ab5c1bc73c313fd2768ae21504b1cd1ac9aa8705529dd,3550
- transformers-0.3.0.0#sha256:4ec3dd53be60415dad46e00ec6c7f78bdc37dcda1670cf5abe5c480719b78b60,2318
Now there is a new error occurred:
E:\work-category-theory\quick-sort>stack build
The same package name is used in multiple local packages
comonad-transformers used in:
- PLImmutable (PLIHackage (PackageIdentifier {pkgName = PackageName "comonad-transformers", pkgVersion = mkVersion [3,1]
}) 6641d4d5466a1e5e5b3863654d1df224c0980c332cf648b17ff148312bcf3f3b,1372 (TreeKey ced3d6e9e6804e43646e6f8b23c8354808074a
403efeadc3e9befd628a78ea46,1116))
- PLImmutable (PLIHackage (PackageIdentifier {pkgName = PackageName "comonad-transformers", pkgVersion = mkVersion [4,0]
}) cdc81f6837836ec4b120ced8503b54a7f1e230e08971cc01717dcd16ba1ceb28,831 (TreeKey 1319b9d5039d6252803e684d0e42431867b20c9
03b49ddb6d5910b2b8eeb02e7,414))
comonads-fd used in:
- PLImmutable (PLIHackage (PackageIdentifier {pkgName = PackageName "comonads-fd", pkgVersion = mkVersion [3,0,3]}) 7fd0
4f220367fe8c0cd2b8c35ca15bc77a7d93a3d45f276435a094f9bdb44a60,1376 (TreeKey 7714b845bc4ba432b5b48054a45ba606ce72c7bfa2242
d3faed5387f8786e5b5,709))
- PLImmutable (PLIHackage (PackageIdentifier {pkgName = PackageName "comonads-fd", pkgVersion = mkVersion [4,0]}) 92ed08
f50f64aa9ce57214c9f0539e0244225ef4c934065dff819a751b89eeaf,817 (TreeKey 275c7b8e4336d289ef0f280260ac9da408f1b41bd2a49b1c
55699bfbf96c9c82,463))
It seems that there is some duplicate packages (comonad-transformers and comonads-fd)?
I remove lower version and rebuild it:
E:\work-category-theory\quick-sort>stack build
Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for cabal-doctest-1.0.8:
Cabal must match >=1.10 && <3.3, but the stack configuration has no specified version (latest matching version
is 3.2.0.0)
needed due to quick-sort-0.1.0.0 -> cabal-doctest-1.0.8
In the dependencies for distributive-0.6.2:
Cabal needed, but the stack configuration has no specified version (latest matching version is 3.2.0.0)
needed due to quick-sort-0.1.0.0 -> distributive-0.6.2
In the dependencies for hashable-1.3.0.0:
text must match >=0.12 && <1.3, but the stack configuration has no specified version (latest matching version
is 1.2.4.0)
needed due to quick-sort-0.1.0.0 -> hashable-1.3.0.0
In the dependencies for reducers-3.12.3:
text must match >=0.11.1.5 && <1.3, but the stack configuration has no specified version (latest matching version
is 1.2.4.0)
needed due to quick-sort-0.1.0.0 -> reducers-3.12.3
In the dependencies for transformers-0.3.0.0:
base-4.13.0.0 from stack configuration does not match >=2 && <4.8 (latest matching version is 4.7.0.2)
needed due to quick-sort-0.1.0.0 -> transformers-0.3.0.0
Some different approaches to resolving this:
* Build requires unattainable version of base. Since base is a part of GHC, you most likely need to use a different
GHC version with the matching base.
Plan construction failed.
Now I have been completely confused...
Why stack can't resolve packages' dependencies automatically?
Can someone help me?
Very thanks!
Quoting a comment:
Yes, it is new project (a small program). I just use Algebra, Coalgebra and hylo to implement quick-sort. I can write these type constructor and function by myself. For DRY, I found these packages from hackage...
If you need the package exclusively for that, just switch to recursion-schemes as Joseph Sible suggests and spare yourself the trouble. That said, it won't hurt to say a thing or two about the installation difficulties you noted.
category-extras is a very large and very old library which was, a long time ago, split into many other libraries. Ideally, you'd just install some or all of the replacement libraries and forget about category-extras entirely. Unfortunately, Control.Functor.Algebra didn't get an official replacement, according to the list of replacements from the version 1.02 docs (in the case of Control.Morphism.Hylo, at least some of the functionality can be obtained with recursion-schemes). That means you might still want to actually use category-extras.
In any case, one thing you definitely don't want is to install category-extras-1.0.2, the most recent version. It is just a meta-package that provides no code of its own, merely pulling a large number of replacement packages. Furthermore, since that version is from 2012, many of those replacement packages were themselves replaced at this point.
If you really must use category-extras, your best bet might be sticking to category-extras-0.53.5.1 (I'm linking to 0.53.5 because the 0.53.5.1 docs don't show up properly on Hackage), the latest version before the split. It depends on mtl < 2, which is annoying because that is an extremely old version of a package that is used pretty much everywhere. Furthermore, mtl-1.1.1 has a base < 4.6 upper bound. That means GHC 7.4.2 or older is needed, and so installing it with Stack won't work. ghcup won't help either (the earliest GHC it supports is 7.10.3), so you'd have to do a standalone installation GHC 7.4.2, either in a VM or using some other strategy to keep it apart from your usual GHC version.

stack install ghc-mod fails with dependencies conflicts on OSX 10.13.4

When I try to install ghc-mod via stack I end up having these depencies conflicts
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for ghc-mod-5.8.0.0:
Cabal-2.0.1.1 from stack configuration does not match >=1.18 && <1.25 (latest matching version is 1.24.2.0)
base-4.10.1.0 from stack configuration does not match >=4.6.0.1 && <4.10 (latest matching version is 4.9.1.0)
cabal-helper must match <0.8 && >=0.7.3.0, but the stack configuration has no specified version (latest matching version is 0.7.3.0)
extra-1.6.8 from stack configuration does not match <1.6 && >=1.4 (latest matching version is 1.5.3)
ghc-8.2.2 from stack configuration does not match >=7.6 && <8.2
haskell-src-exts-1.20.2 from stack configuration does not match <1.20 && >=1.18 (latest matching version is 1.19.1)
hlint-2.1.6 from stack configuration does not match <2.1 && >=2.0.8 (latest matching version is 2.0.15)
monad-journal-0.8.1 from stack configuration does not match <0.8 && >=0.4 (latest matching version is 0.7.2)
optparse-applicative-0.14.2.0 from stack configuration does not match >=0.13.0.0 && <0.14 (latest matching version is 0.13.2.0)
needed since ghc-mod is a build target.
Some different approaches to resolving this:
* Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some working build configuration. This can be convenient when dealing with many complicated constraint
errors, but results may be unpredictable.
* Recommended action: try adding the following to your extra-deps in /Users/mo/.stack/global-project/stack.yaml:
- Cabal-1.24.2.0
- base-4.9.1.0
- cabal-helper-0.7.3.0
- extra-1.5.3
- haskell-src-exts-1.19.1
- hlint-2.0.15
- monad-journal-0.7.2
- optparse-applicative-0.13.2.0
if I try to add the suggested extra deps like so
extra-deps:
- Cabal-1.24.2.0
- base-4.9.1.0
- cabal-helper-0.7.3.0
- extra-1.5.3
- haskell-src-exts-1.19.1
- hlint-2.0.15
- monad-journal-0.7.2
- optparse-applicative-0.13.2.0
- process-1.4.3.0
- either-4.4.1.1
- free-4.12.4
I end up having a loop like this
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for ghc-mod-5.8.0.0:
base-4.10.1.0 from stack configuration does not match >=4.6.0.1 && <4.10 (latest matching version is 4.9.1.0)
ghc-8.2.2 from stack configuration does not match >=7.6 && <8.2
needed since ghc-mod is a build target.
In the dependencies for haskell-src-exts-util-0.2.3:
haskell-src-exts-1.19.1 from stack configuration does not match >=1.20.0 (latest matching version is 1.20.2)
needed due to ghc-mod-5.8.0.0 -> haskell-src-exts-util-0.2.3
In the dependencies for hlint-2.0.15:
haskell-src-exts-1.19.1 from stack configuration does not match >=1.20 && <1.21 (latest matching version is 1.20.2)
needed due to ghc-mod-5.8.0.0 -> hlint-2.0.15
Some different approaches to resolving this:
* Set 'allow-newer: true' to ignore all version constraints and build anyway.
* Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some working build configuration. This can be convenient when dealing with many complicated constraint
errors, but results may be unpredictable.
* Recommended action: try adding the following to your extra-deps in /Users/mo/.stack/global-project/stack.yaml:
- base-4.9.1.0
- haskell-src-exts-1.20.2
if i put - haskell-src-exts-1.20.2 they ask me for - haskell-src-exts-1.19.1 back and vice versa I can't figure out what to do about this dependency conflict, and also I tried to run stack resolver but it doesn't get me anywhere
The issue is that ghc-mod does not support newer versions of GHC, I believe the last supported version is GHC 8.0. You can try changing your Stack resolver to lts-8.24 or nightly-2017-06-28 (see the snapshots listed on ghc-mod's Stackage page).
Even easier, this worked for me:
stack install ghc-mod --resolver lts-8.24
input command line:
stack install ghc-mod --resolver lts-8.24
it really helps.

While constructing the build plan, the following exceptions were encountered

I am trying to install
stack install ghc-mod
and I've got the following error:
In the dependencies for ghc-mod-5.8.0.0:
Cabal-2.0.1.1 from stack configuration does not match >=1.18 && <1.25 (latest matching version is 1.24.2.0)
base-4.10.1.0 from stack configuration does not match >=4.6.0.1 && <4.10 (latest matching version is 4.9.1.0)
cabal-helper must match <0.8 && >=0.7.3.0, but the stack configuration has no specified version (latest matching version is 0.7.3.0)
extra-1.6.2 from stack configuration does not match <1.6 && >=1.4 (latest matching version is 1.5.3)
ghc-8.2.2 from stack configuration does not match >=7.6 && <8.2
monad-journal-0.8.1 from stack configuration does not match <0.8 && >=0.4 (latest matching version is 0.7.2)
optparse-applicative-0.14.0.0 from stack configuration does not match >=0.13.0.0 && <0.14 (latest matching version is 0.13.2.0)
needed since ghc-mod is a build target.
Some potential ways to resolve this:
* Recommended action: try adding the following to your extra-deps in /home/developer/.stack/global-project/stack.yaml:
- Cabal-1.24.2.0
- base-4.9.1.0
- cabal-helper-0.7.3.0
- extra-1.5.3
- monad-journal-0.7.2
- optparse-applicative-0.13.2.0
* Set 'allow-newer: true' to ignore all version constraints and build anyway.
* You may also want to try using the 'stack solver' command.
Plan construction failed.
I am using
~/.local/bin$ stack --version
Version 1.6.3, Git revision b27e629b8c4ce369e3b8273f04db193b060000db (5454 commits) x86_64 hpack-0.20.0
and ghc version 8.2.2. How to bypass the error?
Your version of stackage does not have that package https://www.stackage.org/lts-10.4/hoogle?q=ghc-mod . The old one has it https://www.stackage.org/lts-8.23/hoogle?q=ghc-mod . I guess package is considered unmaintained as it was last updated in July 2017.
You can read official documentation on how to add any package from hackage, particular section External Dependencies https://github.com/commercialhaskell/stack/blob/master/doc/GUIDE.md#external-dependencies
However, things might be broken with latest Haskell version.
For lts-10.4 you might use a workaround mentioned here at the very bottom:
Install a release candidate for ghc-mod-5.9.0.0 and some more packages in stack.yaml under extra-deps. Then do a
stack build ghc-mod
stack install ghc-mod
and you're done. At least "works for me" under ghc-8.2.2:
ghc-mod --version
$> ghc-mod version 5.9.0.0 compiled by GHC 8.2.2
I have not encountered any problems using it with atom yet.
Hope this helps.

Stack - How do I (force?) install an old version of a package

So I'm trying to install ghc-mod-5.4.0.0, which crashes with a bunch of other installation:
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for ghc-mod-5.4.0.0:
async-2.1.1 must match <2.1 && >=2.0.2 (latest applicable is 2.0.2)
cabal-helper-0.7.3.0 must match <0.7 && >=0.6.1.0 (latest applicable is 0.6.3.1)
cereal-0.5.4.0 must match <0.5 && >=0.4 (latest applicable is 0.4.1.1)
directory-1.3.0.0 must match <1.3 (latest applicable is 1.2.7.1)
extra-1.5.1 must match ==1.4.* (latest applicable is 1.4.12)
ghc-8.0.2 must match >=7.4 && <7.11
haskell-src-exts-1.18.2 must match <1.18 && >=1.16.0.1 (latest applicable is 1.17.1)
pipes-4.3.2 must match ==4.1.* (latest applicable is 4.1.9)
process-1.4.3.0 must match <1.3 (latest applicable is 1.2.3.0)
time-1.6.0.1 must match <1.6 (latest applicable is 1.5.0.1)
transformers-0.5.2.0 must match <0.5 (latest applicable is 0.4.3.0)
Plan construction failed.
So how do I force it to install that version? Is there a simple way to purge the stack installation cache or something like that?
I think something like
stack --resolver lts-4.2 install ghc-mod
should do the trick, otherwise I would do something along the lines of cabal get ghc-mod-5.4.0.0 and stack init, stack install there. You might need to install/switch to a different ghc-version or use the stack equivalent of --allow-newer

Fail with basic usage of haskell stack

I'm learning Haskell and trying to setup my Emacs development environment (reading this).
One of things I should do is to install hindent.
Recommended method here is just stack install hindent. I guess it should be installed in stack's global-project space. My global stack yaml at $HOME/.stack/global-project/stack.yaml is:
flags: {}
extra-package-dbs: []
packages: []
extra-deps: []
resolver: ghc-7.10.3
I don't use any system ghc (there is no ghc or ghci on my $PATH).
On stack install hindent it adviced me to extend extra-deps:
Run from outside a project, using implicit global project config
Using resolver: ghc-7.10.3 from implicit global project's config file: /home/me/.stack/global-project/stack.yaml
While constructing the build plan, the following exceptions were encountered:
In the dependencies for hindent-5.2.1:
descriptive must match >=0.7 && <0.10, but the stack configuration has no specified version
(latest applicable is 0.9.4)
exceptions must match -any, but the stack configuration has no specified version (latest applicable is 0.8.3)
haskell-src-exts must match >=1.18, but the stack configuration has no specified version
(latest applicable is 1.18.2)
monad-loops must match -any, but the stack configuration has no specified version (latest applicable is 0.4.3)
mtl must match -any, but the stack configuration has no specified version (latest applicable is 2.2.1)
path must match -any, but the stack configuration has no specified version (latest applicable is 0.5.9)
path-io must match -any, but the stack configuration has no specified version (latest applicable is 1.2.0)
text must match -any, but the stack configuration has no specified version (latest applicable is 1.2.2.1)
unix-compat must match -any, but the stack configuration has no specified version (latest applicable is 0.4.2.0)
utf8-string must match -any, but the stack configuration has no specified version (latest applicable is 1.0.1.1)
yaml must match -any, but the stack configuration has no specified version (latest applicable is 0.8.20)
Recommended action: try adding the following to your extra-deps in /home/me/.stack/global-project/stack.yaml:
- descriptive-0.9.4
- exceptions-0.8.3
- haskell-src-exts-1.18.2
- monad-loops-0.4.3
- mtl-2.2.1
- path-0.5.9
- path-io-1.2.0
- text-1.2.2.1
- unix-compat-0.4.2.0
- utf8-string-1.0.1.1
- yaml-0.8.20
When I do what is proposed it suggests some new dependencies (which are probably dependencies of those which are added before) etc. At the end it results in situatuation where some two dependencies have unmet versions.
I presume that something is wrong with my configuration (or understanding of stack) since I think that obtaining implicit dependencies is job of a build tool.
Does someone more experienced can infer what is my beginner fault?
It's not generally recommended to use a ghc version as a resolver, for the reason you've discovered: you need to manually specify lots of package versions. Instead, I'd recommend switching to lts-6.23, or something else similar.
Not sure. If you just wanna get moving fast:
stack upgrade --git && \
rm -rf ~/.stack && \
stack setup && \
stack install hindent
Why not use GHC 8.X and a fresh new Stack? ;)

Resources