如何安装 d3js Haskell 包?

How to install d3js Haskell package?

我只想试试 Haskell d3js 包。这是我尝试过的:

stack install d3js

但它给出了错误:

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

In the dependencies for d3js-0.1.0.0:
    base-4.9.1.0 must match >=4.6 && <4.7 (latest applicable is 4.6.0.1)

我试过 stack install base-4.6.0.1,它没有输出任何东西,但没有错误地完成,但是当我尝试 stack install d3js 时,我仍然得到同样的错误。

我也尝试过使用 cabal:

$ cabal install d3js                         

Resolving dependencies...
cabal: Could not resolve dependencies:
trying: d3js-0.1.0.0 (user goal)
next goal: base (dependency of d3js-0.1.0.0)
rejecting: base-4.9.1.0/installed-4.9... (conflict: d3js => base>=4.6 && <4.7)
rejecting: base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0,
base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0,
base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0,
base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1,
base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1
(constraint from non-upgradeable package requires installed instance)
Dependency tree exhaustively searched.

我做错了什么?我该如何解决这个依赖问题?

这个包很旧,它固定依赖于 base 包(阅读,编译器版本)。

我会先放宽 d3js.cabal 文件中的依赖要求,然后 运行 重新构建。如果那行不通,您需要破解代码,或使用旧的编译器(或堆栈解析器,如果您使用的是堆栈)。

如您所见,d3js 包在基础包上有一个上限。基本包是一组随给定版本的 GHC 一起提供的模块,例如 Prelude。因为 base 附带 GHC,所以如果不安装不同的 GHC,就无法安装与现有版本不同的版本。

d3js 包最后一次(也是唯一一次)更新是在 2013 年,其基本版本范围表明它只能与 GHC 7.6 一起使用。不幸的是,Stack 在 2013 年还不存在,并且没有适用于 GHC 7.6 的 stackage 版本。您可能会成功地指示 Stack(以及 Cabal)忽略版本上限并使用 LTS 2.22 和 GHC 7.8.4,尽管 d3js 包在基础上有上限,但它可能兼容,但我没有测试过这个。您可以通过在 stack.yaml 文件中设置 allow-newer: True 来做到这一点。

然而,d3js 包可能太旧,无法与 Stack 提供的 GHC 一起使用。

作为最后的手段,您可以通过将其下载到本地、更新其边界(并可能修复由此导致的任何不兼容)以及配置 stack.yaml 文件以将其视为本地包和一个额外的依赖项。有关说明,请参阅堆栈配置文档中的 Local dependency packages