Haskell堆栈版本依赖项

时间:2018-02-04 19:18:22

标签: haskell haskell-stack

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 == *等版本后缀会出现解析错误,并根据hackage docs给出http == 4000.3.9,给了我http must match ==4000.3.9, but the stack configuration has no specified version

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

1 个答案:

答案 0 :(得分:3)

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

因此,修复软件包名称可以解决问题。

(此外博客文章似乎已经过时了,这些天通过conduit / wreq / req执行HTTP请求的标准方式)。