Haskell 堆栈版本依赖关系

标签 haskell haskell-stack

堆栈新手。我开始构建一个 concurrent web scraper ,并运行stack new my-project simple。在 my-project.cabal 中,我必须插入 hxt、url、http 和 Maybet 的依赖项。

executable my-project
  hs-source-dirs:      src
  main-is:             Main.hs
  default-language:    Haskell2010
  build-depends:       base >= 4.7 && < 5,
                       time,
                       hxt,
                       http,
                       maybet

当我运行stack build时,我得到:

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

In the dependencies for my-project-0.1.0.0:
    http must match -any, but the stack configuration has no specified version
    maybet must match -any, but the stack configuration has no specified version
needed since my-project is a build target.

Some potential ways to resolve this:

  * Set 'allow-newer: true' to ignore all version constraints and build anyway.

  * You may also want to try using the 'stack solver' command.

在可执行指令下插入 allow-newer: true 似乎不起作用,并且添加像 http == * 这样的版本后缀会产生解析错误,并给出它http == 4000.3.9, 按照hackage docs给我 http 必须匹配 ==4000.3.9,但堆栈配置没有指定版本

有没有一种简单的方法可以告诉 cabal 文件我想要最新版本?

最佳答案

Hackage 中没有名为 http 的包。但是您有一个名为 HTTP 的包。

因此,修复包名称应该可以解决您的问题。

(而且博客文章似乎已经过时了,现在执行 HTTP 请求的标准方法是通过管道/wreq/req)。

关于Haskell 堆栈版本依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48612055/

相关文章:

json - Haskell, Aeson - 是否有更好的解析历史数据的方法?

haskell - 如何使 Stack 只构建一个可执行文件?堆栈构建 :exe1 doesn't work?

haskell - 堆栈将包保存在其缓存中多长时间?

haskell - 找不到模块 `Data.Map' -- 它是隐藏包的成员

sqlite - 持久性的新手问题

haskell - 当你依赖一个 cabal 包时,它似乎会在所有 cabal 节中引入依赖关系

haskell - 适用于 <$> 和 <*> 的运算符部分

haskell - ghc-pkg:无法打开数据库进行修改:hLock:无效参数

haskell - Stack 上可以有不同的编译器和解析器吗?

haskell - 管道.并发: Sent signal is delivered one click later than expected