堆栈新手。我开始构建一个 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/