haskell – 堆栈无法正确解析依赖关系

我正在尝试在新的Ubuntu 16.04实例上设置 Hakyll,但我似乎无法正确获得基于堆栈的设置说明.

从堆栈安装hakyll开始,我得到:

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

In the dependencies for hakyll-4.9.3.0:
    http-conduit-2.1.11 must match >=2.2 && <2.3 (latest applicable is 2.2.3)

Plan construction failed.

绑定到堆栈安装http-conduit-2.1.11时出现了类似的错误,这次是:

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

In the dependencies for http-conduit-2.2.3:
    http-client-0.4.31.2 must match >=0.5 && <0.6 (latest applicable is 0.5.5)
    http-client-tls-0.2.4.1 must match >=0.3 && <0.4 (latest applicable is 0.3.3.1)

Plan construction failed.

在解决了这个依赖关系(也使用Stack)后,我再次尝试堆栈安装http-conduit-2.1.11,但我再一次得到了相同的依赖错误.

软件包http-client-0.4.31.2和http-client-tls-0.2.4.1出现在我的〜/ .stack / precompiled / x86_64-linux / ghc-8.0.1 / 1.24.0.0 /中,它没有明确地出现在我的$PATH,但感觉这是一个非常hacky解决方案,我没有找到任何文档推荐这种方法.

如何在我的机器上正确安装Hakyll?

解决方法

使用堆栈的依赖管理意味着可重现和声明,这意味着堆栈项目只会在项目的.cabal文件中记录所有依赖项后才会编译,并且一旦项目的stack.yaml定义了这些项目的版本依赖关系在 resolverextra-deps部分.

您的困惑似乎源于对堆栈安装的误解.命令行帮助可以这样说:

build                    Build the package(s) in this directory/configuration
  install                  Shortcut for 'build --copy-bins'
...
  --[no-]copy-bins         Enable/disable copying binaries to the local-bin-path
                           (see 'stack path')

堆栈安装不保存任何依赖项.

因此,将hakyll作为对代码的依赖关系的正确方法是:

>如果您已经拥有Cabal包,则使用堆栈init创建一个正确的堆栈项目,如果不是,则使用stack new.>将hakyll添加到库或可执行构建 – 依赖于.cabal文件.>尝试堆叠构建并按照任何错误消息中的说明进行操作,直到解决所有问题.

相关文章

什么是设计模式一套被反复使用、多数人知晓的、经过分类编目...
单一职责原则定义(Single Responsibility Principle,SRP)...
动态代理和CGLib代理分不清吗,看看这篇文章,写的非常好,强...
适配器模式将一个类的接口转换成客户期望的另一个接口,使得...
策略模式定义了一系列算法族,并封装在类中,它们之间可以互...
设计模式讲的是如何编写可扩展、可维护、可读的高质量代码,...