"stack configuration"、xxx.cabal、cabal.config中的依赖约束是什么关系?

What is the relationship between dependency constraints in "stack configuration", xxx.cabal, and cabal.config?

我还没有尝试解决这个问题;首先我想了解问题出在哪里:

TextTerra $ stack --nix test

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

In the dependencies for TextTerra-0.1.0.0:
    easytest-0.2 from stack configuration does not match ==0.2.1  (latest matching version is 0.2.1)
needed since TextTerra is a build target.

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 /home/brandon/workspace/TextTerra/stack.yaml:

- easytest-0.2.1

Plan construction failed.

现在没有对 easytest 的其他引用,尤其是 easytest-0.2;唯一的参考是我刚刚添加的:

TextTerra $ rg easytest
TextTerra.cabal
67:      , easytest == 0.2.1

但是,cabal.config 中引用了 easytest-0.2。我不知道这个文件的相关性,因为快速搜索并没有发现太多,删除文件对构建没有影响(特别是,我收到了上面相同的错误消息)。

在...

easytest-0.2 from stack configuration does not match ==0.2.1

... "stack configuration" 表示通过 resolver 指定的一组包(通常是 Stackage 快照——您可以在 [=21] 的快照中找到包和版本列表=]) 和 stack.yaml 中的 extra-deps,而 ==0.2.1 约束是您的 .cabal 文件所要求的。错误消息给出的建议(忽略 .cabal 上限 allow-newer,并将包添加到 extra-deps)适用于您想要或需要使用特定的解析器。如果不是这种情况(例如,如果您正在尝试将旧项目更新为最新的 LTS 快照),您还可以将解析器更改为包含您正在寻找的包和版本的内容(如果这样的解析器可用) ).