Search code examples
haskellhaskell-stacktasty

Trouble including tasty-quickcheck in the build


I am new to stack.

I have a stack project that I want to use tasty-quickcheck. When I add tasty-quickcheck to package.yaml, stack asks me to add it to stack.yaml as well under extra-deps section. After adding tasty-quickcheck-0.10.1.1 to extra-deps stack asked me to add around a dozen more packages to extra-deps which I added.

Now I am at a stage where I get the following error when I try to do stack build.

stack build

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for transformers-compat-0.6.5:
    transformers-0.5.6.2 from stack configuration does not match >=0.3 && ==0.2.* 
needed due to tic-tac-toe-0.1.0.0 -> transformers-compat-0.6.5

Some different approaches to resolving this:

  * Set 'allow-newer: true'
    in /Users/home/.stack/config.yaml to ignore all version constraints and build anyway.


Plan construction failed.

My package.yaml looks like below.

...
dependencies:
- base   >= 4.7 && < 5
- vector
- mtl
- tasty-quickcheck
...

My stack.yaml looks like below.

...
resolver: ghc-8.8.3
extra-deps:
  - vector-0.12.1.2
  - primitive-0.7.0.1
  - tasty-quickcheck-0.10.1.1
  - random-1.1
  - tagged-0.8.6
  - tasty-1.3.1
  - QuickCheck-2.14
  - ansi-terminal-0.10.3
  - async-2.2.2
  - clock-0.8
  - optparse-applicative-0.15.1.0
  - unbounded-delays-0.1.1.0
  - wcwidth-0.0.2
  - ansi-wl-pprint-0.6.9
  - colour-2.3.5
  - hashable-1.3.0.0
  - splitmix-0.0.5
  - transformers-compat-0.6.5
...

I have two questions.

  1. How do I fix the error above?
  2. Is it usual that stack tells you to add a dozen more dependencies just to get a single package like tasty-quickcheck included? That doesn't sound great to me. Is that the norm with most packages?

Solution

  • Quoting a comment:

    Which resolver (or snapshot) is specified in your stack.yaml?

    @duplode It is resolver: ghc-8.8.3

    You presumably don't want to use the ghc-* resolvers in this case. They only specify the GHC version (and the version of small handful of packages which are bundled with GHC), which is why you had to add everything else to extra-deps. Change the resolver to lts-16.0 (the most recent Stackage LTS, which does include tasty-quickcheck-0.10.1.1), remove the extra-deps from the stack.yaml file; that should be enough for things to work.