首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么堆栈不使用定义的额外依赖项?

为什么堆栈不使用定义的额外依赖项?
EN

Stack Overflow用户
提问于 2019-01-02 02:52:54
回答 2查看 198关注 0票数 0

我向Haskell的蛇眼项目提交了一个更改,这是我正在进行的一个项目所需要的。更改在版本0.6.7003.1中,该版本尚未传播到nixos存储库(nixos.org显示其当前版本为0.6.7001.0)。

由于这个所需的依赖项与解析器的LTS版本不同,我在stack.yaml中标记了额外的依赖项

代码语言:javascript
复制
packages:
- git@github.com:tomjaguarpaw/haskell-opaleye.git
- commit: cf3296c5ffef58d36dd6b386ae53dff519ee47e9

我还在我的build-depends文件project.cabal中标记了这个版本:

代码语言:javascript
复制
build-depends: opaleye >= 0.6.7003.1 && < 1

然后,当我试图构建时,我得到了以下错误:

代码语言:javascript
复制
$ stack build

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

In the dependencies for taskmaster-0.1.0.0:
    opaleye must match >=0.6.7003.1 && <1, but the stack configuration has no specified version  (latest matching version is 0.6.7003.1)
needed since taskmaster 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 /home/matthew/backup/taskmaster/taskmaster/stack.yaml:

opaleye-0.6.7003.1@sha256:914ac99c6f7ceea050df843ac31c33be0f6340bc0f05753c8fdfc18074fa9e5b

Plan construction failed.

(我不明白这个长(>40个字符) sha256散列来自何处)。我遵循了这个建议,并在我的stack.yaml中添加了以下内容。

代码语言:javascript
复制
extra-deps:
- opaleye-0.6.7003.1@sha256:914ac99c6f7ceea050df843ac31c33be0f6340bc0f05753c8fdfc18074fa9e5b

当我运行$ stack build来构建我的项目时,编译器会尝试构建,而不会显示任何依赖错误。但是,如果它使用包含我的更改的Opaleye版本,则会产生一个类型错误。而且,当我运行$ stack ghci并导入相关的opaleye模块时,我的更改是不存在的。似乎堆栈仍然在使用较旧的opaleye版本。如何才能让堆栈使用包含更改的较新版本的蛋白石眼?我的尝试似乎已经用尽了haskell堆栈文档中提到的选项。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-01-04 03:09:48

原来堆栈的extra-deps建议是不正确的。我注意到了此堆栈github问题下的另一种格式,给了它一次尝试,它碰巧对我有用。下面列出了工作的extra-deps格式。

代码语言:javascript
复制
extra-deps:
- github: tomjaguarpaw/haskell-opaleye
  commit: cf3296c5ffef58d36dd6b386ae53dff519ee47e9
票数 0
EN

Stack Overflow用户

发布于 2019-01-08 14:42:39

hackage选项通常比github外挂更好。

您最初尝试的正确语法是

代码语言:javascript
复制
extra-deps:
- git: https://github.com/tomjaguarpaw/haskell-opaleye.git
  commit: cf3296c5ffef58d36dd6b386ae53dff519ee47e9

github: tomjaguarpaw/haskell-opaleye版本只是一条捷径。

sha256散列是与该版本(和修改版)对应的阴谋文件的sha256sum。

考虑到opaleye的版本是已经被黑客攻击了,您应该能够添加堆栈建议的行。您可能希望在进行更改后尝试一个stack clean (尽管它不应该是必要的)。

如果你提供更多的信息,我会更新这个答案。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54000712

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档