Why can't I use Text.Regex in my Stack project? - haskell

All I want is to parse a simple string using regex.
First question: Should I be using Text.Regex or something else? Stackage lists at least 11 regex packages. I don't care if it's PCRE or Posix. At this point I'll accept anything.
Second Question: How do I include Text.Regex in my project? This is my experience so far:
package.yaml has
dependencies:
- base >= 4.7 && < 5
- regex
stacky.yaml attempt 1
extra-deps:
- regex-1.0.1.3
Response to stack build
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for regex-1.0.1.3:
base-compat-0.10.5 from stack configuration does not match >=0.6 && <0.10 (latest matching version is 0.9.3)
template-haskell-2.13.0.0 from stack configuration does not match >=2.7 && <2.12 (latest matching version is 2.11.1.0)
needed due to CCompiler-0.1.0.0 -> regex-1.0.1.3
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/adamfrank/Dev/Haskell/CCompiler/stack.yaml:
- base-compat-0.9.3
- template-haskell-2.11.1.0
Plan construction failed.
stack.yaml attempt 2
extra-deps:
- regex-1.0.1.3
- base-compat-0.9.3
- template-haskell-2.11.1.0
Response to stack build:
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for regex-1.0.1.3:
template-haskell-2.13.0.0 from stack configuration does not match >=2.7 && <2.12 (latest matching version is 2.11.1.0)
needed due to CCompiler-0.1.0.0 -> regex-1.0.1.3
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/adamfrank/Dev/Haskell/CCompiler/stack.yaml:
- template-haskell-2.11.1.0
Plan construction failed.
???
It says I need to add a line I already added.
Do I need a different version of regex? If so, which one, and how do I figure that out?

There are a few recommendations in the comments as to what to use: regex-base, but it is also good to understand why it is not compiling.
Stackage provides a list of compatible packages in each LTS. You can alter some of the version numbers as long as they respect the version constraints of other dependencies. Not all of these dependency restrictions are well defined in the packages coming from Hackage, which is one of the reasons for using Stackage.
Generally each stackage major LTS release is associated with a particular version of GHC which also has a particular version of base. When you pick a major version of LTS, you are also picking a version of GHC and base. If you want to change GHC and/or base versions, it is easier to change the LTS version. The first thing after the LTS version on the Stackage LTS page is the GHC version number.
In your case regex requires a version of template-haskell and base-compat that violate the constraints of other 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.

How to resolve dependency tree with different version ranges of same packages?

I'm trying to set up a happstack-lite application using stack.
I initialized project with these commands:
stack new my-happstack
cd my-happstack
stack setup
I changed package.yaml so it contains:
dependencies:
- base >= 4.7 && < 5
- happstack-lite >= 7.3
Then I ran stack build several times and changed extra-deps in stack.yaml in project directory according to recommendations (added dependencies, such as happstack-server).
Apparently, I was asked to add to extra-deps the packages already listed there, with different version bounds and one with the same (template-haskell-2.11.1.0):
stack.yaml content:
extra-deps:
- happstack-lite-7.3.6
- happstack-server-7.4.6.4
- Win32-2.2.2.0#sha256:10ed55dd31315f386910c121c1d1d442df83bd2ee92090a753cd65300735a8ca
- network-2.6.3.6#sha256:1ca79d81af02d7acd6032d5e6c9bde4618a8fdcfbe19bd42b49d420183975df0
- template-haskell-2.11.1.0#sha256:f90d6ab73ad35c749e8547ca132e7ab5d32d2f8e7bb2e2ff6d597be26b58e061
- transformers-compat-0.5.1.4#sha256:1b4bfa8589afb1ca0e719129ab261bd90ef0cc3e6c0b9963f94970c082b61250
output from stack build:
F:\Projects\Haskell\my-happstack>stack build
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for Cabal-2.4.1.0:
Win32-2.2.2.0 from stack configuration does not match >=2.3.0.0 && <2.9 (latest matching
version is 2.8.3.0)
needed due to my-happstack-0.1.0.0 -> Cabal-2.4.1.0
In the dependencies for happstack-server-7.4.6.4:
template-haskell-2.14.0.0 from stack configuration does not match <2.12 (latest matching
version is 2.11.1.0)
needed due to my-happstack-0.1.0.0 -> happstack-server-7.4.6.4
In the dependencies for transformers-base-0.4.5.2:
transformers-compat-0.5.1.4 from stack configuration does not match >=0.6.1 (latest matching
version is 0.6.4)
needed due to my-happstack-0.1.0.0 -> transformers-base-0.4.5.2
Some different approaches to resolving this:
* Set 'allow-newer: true' in C:\sr\config.yaml 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 F:\Projects\Haskell\my-happstack\stack.yaml:
Win32-2.8.3.0#sha256:58fa6f52e8a0d455a74bb19445c177f2cc79a0975cae5fd96e2334bd38a516d4
template-haskell-2.11.1.0#sha256:f90d6ab73ad35c749e8547ca132e7ab5d32d2f8e7bb2e2ff6d597be26b58e061
transformers-compat-0.6.4#sha256:d298cd9d1bb7b05160229e244436bae825b53660865e3d5fd695ea0fafec1e6f
Plan construction failed.
I've tried these steps:
1) Set 'allow-newer: true' in C:\sr\config.yaml. In this case, I'm getting error about wrong types usage from inside one of the dependent packages (can paste error output upon request, if needed).
2) Run stack solver. I've got the error from cabal planner (error output upon request).
So, I expect stack to resolve dependencies the way npm does - each package dependencies are resolved independently from other's packages needs. Any advice of how I can solve this particular problem will be helpful, though (including manual dependencies resolving).

Haskell dependency hell

I'm trying to include a specific version of a library in a Haskell project. The library is bed-and-breakfast (which is used for martix operations), but I need the specific version 0.4.3 which fixed a bug with the multiplication implementation.
So, my stack.yaml looks like this:
flags: {}
extra-package-dbs: []
packages:
- .
extra-deps:
- bed-and-breakfast-0.4
- base-4.6.0.1
resolver: lts-12.8
But I'm getting this error when building:
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for bed-and-breakfast-0.4:
base-4.11.1.0 from stack configuration does not match >=4.5 && <4.7 (latest matching version
is 4.6.0.1)
needed due to realworldhaskell-0.1.0.0 -> bed-and-breakfast-0.4
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 C:\Users\info\Desktop\Projects\haskell\stack.yaml:
- base-4.6.0.1
I've done the recommended action but it didn't solve anything. I've tried using different resolvers to see if it's an issue with my GHCi version but nothings worked. What is the best way to interpret error messages like this and how should I proceed?
EDIT:
If I remove -base.4.6.0.1 and add allow-newer: true I get this:
WARNING: Ignoring out of range dependency (allow-newer enabled): base-4.11.1.0. bed-and-breakfast requires: >=4.5 && <4.7
bed-and-breakfast-0.4: configure
Progress 1/2
-- While building custom Setup.hs for package bed-and-breakfast-0.4 using:
C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.2.0.1_ghc-8.4.3.exe --builddir=.stack-work\dist\7d103d30 configure --with-ghc=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3\bin\ghc.EXE --with-g
hc-pkg=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3\bin\ghc-pkg.EXE --user --package-db=clear --package-db=global --package-db=C:\sr\snapshots\76fd1958\pkgdb --package-db=C:\Users\info\Desktop\Projects\haskell\
.stack-work\install\8c390635\pkgdb --libdir=C:\Users\info\Desktop\Projects\haskell\.stack-work\install\8c390635\lib --bindir=C:\Users\info\Desktop\Projects\haskell\.stack-work\install\8c390635\bin --datadir=C:\Users\info\Desktop\Proj
ects\haskell\.stack-work\install\8c390635\share --libexecdir=C:\Users\info\Desktop\Projects\haskell\.stack-work\install\8c390635\libexec --sysconfdir=C:\Users\info\Desktop\Projects\haskell\.stack-work\install\8c390635\etc --docdir=C:
\Users\info\Desktop\Projects\haskell\.stack-work\install\8c390635\doc\bed-and-breakfast-0.4 --htmldir=C:\Users\info\Desktop\Projects\haskell\.stack-work\install\8c390635\doc\bed-and-breakfast-0.4 --haddockdir=C:\Users\info\Desktop\Pr
ojects\haskell\.stack-work\install\8c390635\doc\bed-and-breakfast-0.4 --dependency=array=array-0.5.2.0 --dependency=base=base-4.11.1.0 --dependency=binary=binary-0.8.5.1 --dependency=deepseq=deepseq-1.4.3.0 --dependency=template-hask
ell=template-haskell-2.13.0.0 --extra-include-dirs=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include --extra-lib-dirs=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\min
gw64\bin --extra-lib-dirs=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib --exact-configuration
Process exited with code: ExitFailure 1
Logs have been written to: C:\Users\info\Desktop\Projects\haskell\.stack-work\logs\bed-and-breakfast-0.4.log
Configuring bed-and-breakfast-0.4...
Cabal-simple_Z6RU0evB_2.2.0.1_ghc-8.4.3.exe: The package has an impossible
version range for a dependency on an internal library: bed-and-breakfast
==0.3.2. This version range does not include the current package, and must be
removed as the current package's library will always be used.
EDIT 2:
Ok, so I'm guessing that the bed-and-breakfast library needs base 4.11.1.0 which is included in GHCi 6.10.2 (according to https://wiki.haskell.org/Base_package) so I need a resolver which matches that GHCi version. Where can I find out what resolver version that is?
Here is the constraint on the latest available bed-and-breakfast package: base (>=4.5 && <4.7), which means it will likely not even compile with GHC version higher then 7.6. Considering that there is even no LTS snapshot prior to GHC 7.8, you are out of luck with that package.
To say it in another words, the package is outdated and your choices are:
submit an issue and hope maintainer will do something about it
try to make it work with newer ghc yourself
Use a different package

Stack is unable to resolve the correct package version

I am trying to use grenade in Haskell. Using stack as a configuration tool, I have
# stack.yaml
extra-deps:
- diagrams-solve-0.1.1
- dual-tree-0.2.2
- SVGFonts-1.6.0.3
- diagrams-core-1.4.1
- diagrams-lib-1.4.2.2
- diagrams-postscript-1.4.1
- diagrams-svg-1.4.2
- Chart-diagrams-1.8.3
- hip-1.5.3.0
- singletons-2.2
- template-haskell-2.11.1.0
- th-desugar-1.6
- grenade-0.1.0
But when I execute stack build, it gives me the following error
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for th-desugar-1.6:
template-haskell-2.12.0.0 from stack configuration does not match <2.12 (latest
matching version is 2.11.1.0)
needed due to Brain-0.1.0.0 -> th-desugar-1.6
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 [Project directory]/stack.yaml:
- template-haskell-2.11.1.0
Plan construction failed.
Even if I put - template-haskell-2.11.1.0 before diagrams-solve, stack still gives me the same error. Allowing newer versions is not viable since it breaks th-desugar.
That looks like a lot of extra-deps. I'd recommend figuring out a good resolver first. The best way to do that is use the original repo:
git clone git#github.com:HuwCampbell/grenade.git
cd grenade
stack init
Which gives you the following output:
Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- ./
- examples/
Selecting the best among 13 snapshots...
* Partially matches lts-11.13
criterion version 1.3.0.0 found
- grenade requires ==1.1.*
Downloaded nightly-2018-06-16 build plan.
* Partially matches nightly-2018-06-16
criterion version 1.4.1.0 found
- grenade requires ==1.1.*
hmatrix version 0.19.0.0 found
- grenade requires ==0.18.*
- grenade-examples requires ==0.18.*
singletons version 2.4.1 found
- grenade requires >=2.1 && <2.4
* Partially matches lts-10.10
criterion version 1.2.6.0 found
- grenade requires ==1.1.*
Downloaded lts-9.21 build plan.
* Matches lts-9.21
Selected resolver: lts-9.21
Initialising configuration using resolver: lts-9.21
Total number of user packages considered: 2
Writing configuration to file: stack.yaml
All done.
So use the base resolver lts-9.21. And I'd open an issue on the repo of grenade to add it to stack.

Installing a package outside current resolver

I'm using stack lts-9.0 snapshot, which includes process-1.4.X. Due to some problems with this version, I would like to use process-1.6.1.0. Adding this version to extra-deps does not seem to be enough:
extra-deps:
- process-1.6.1.0
since this will cause the following error:
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for Cabal-1.24.2.0:
process-1.6.1.0 must match >=1.1.0.1 && <1.5 (latest applicable is 1.4.3.0)
What do I need to do in these cases?
As written in the message, the problem is with Cabal-1.24.2.0 depending on process < 1.5.
Add Cabal-2.0.0.2 to the extra-deps.

Resources