Haskell堆栈包安装错误

Haskell Stack package installation error

user$: stack install dictionaries

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

In the dependencies for dictionaries-0.1.0.0:
    binary-0.8.3.0 must match >=0.7.5 && <0.8 (latest applicable is 0.7.6.1)
    time-1.6.0.1 must match >=1.5.0 && <1.6 (latest applicable is 1.5.0.1)

使用上面的命令,我想全局安装 dictionaries 包。

我在这里有哪些选择? 我打算stack unpack dictionaries,然后修改版本。 但是如何全局安装修改后的 'local' 包?

此处的最佳做法是什么?

谢谢

最简单的方法:将 allow-newer: true 添加到 stack.yaml

这将是这种情况下的解决方案。它解决了像你这样的版本限制问题。但是当然也有构建失败的可能。

可能的一个:将解析器更改为最新的 nightly

该故障有时会发生在夜间快照上。通常通过库更新和新的夜间快照很快修复。如果您使用的是旧快照,请将其更改为最新快照。或者等待可能是解决方案之一。

最一般的一种:依赖修改后的本地包

您可以通过将包路径添加到 stack.yaml packages: 来完成。然后堆栈将使用它而不是快照一。

您想要的方式可能不是一个好主意。即使那是可能的,您将如何处理多个版本的快照情况?应为每个包指定本地依赖项。

With the above command, I want to install the dictionaries package globally.

(初步说明:"globally",我假设你的意思是全局 为你的用户 ,而不是 system-wide 安装。)

dictionaries is not in any Stackage snapshot. As far as I'm aware of, that means you cannot install it globally, as for libraries that is only an option if the package is in a snapshot. Cf. Stack issue #2656 -- 虽然那里描述的计划功能听起来像您正在尝试做的,但有一个警告:

Should also warn when it isn't used with --copy-bins, and if there are targets that don't have executables, as these both indicate a misunderstanding about how it works.

既然如此,我的建议是使用 the packages field with an extra-dep key -- that is, the "most general" solution in .

安装包 per-project