在构建中加入tasty-quickcheck有问题

问题描述 投票:0回答:1

我是堆栈的新手。

我有一个堆栈项目,我想使用tasty-quickcheck。当我添加 tasty-quickcheck 到package.yaml,堆栈要求我把它也添加到stack.yaml的extra-deps部分。在添加了 tasty-quickcheck-0.10.1.1 到extra-deps堆栈中,要求我再添加十几个包到extra-deps中。

现在我在这个阶段,当我尝试执行 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.

我的package.yaml看起来像下面的样子。

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

我的stack.yaml看起来像下面。

...
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
...

我有两个问题。

  1. 如何解决上面的错误?
  2. 堆栈告诉你添加十几个依赖关系只是为了得到一个像tasty-quickcheck这样的包,这是通常的做法吗?我觉得这听起来并不怎么样。大多数包都是这样的吗?
haskell haskell-stack tasty
1个回答
2
投票

引用一个评论。

哪些 resolver (或 snapshot)是在您的 stack.yaml?

@duplode 它是 resolver: ghc-8.8.3

你大概是不想使用 ghc-* 解析器。他们只指定了GHC的版本(以及一小部分与GHC捆绑在一起的包的版本),这就是为什么你必须把其他所有东西都添加到 extra-deps. 更改 resolverlts-16.0 (最新的Stackage LTS。其中确实包括 tasty-quickcheck-0.10.1.1),去除 extra-deps 来自 stack.yaml 文件;这应该足以让事情运转起来。

© www.soinside.com 2019 - 2024. All rights reserved.