删除Stack / Cabal包并安装旧版本

时间:2016-02-14 00:00:14

标签: haskell cabal haskell-stack build-dependencies hackage

我是Haskell的新手,并且正在使用Stack在Mac OSX上构建一个小型个人项目。我最近在我的cabal文件中添加了一些新的build-deps,但现在当我运行stack build时,我收到以下错误:

--  While attempting to add dependency,
    Could not find package api-builder in known packages

--  Failure when adding dependencies:
      api-builder: needed (==0.11.0.0), not present in build plan (latest applicable is 0.11.0.0)
      http-client: needed (==0.4.20), 0.4.27 found (latest applicable is 0.4.20)
      http-types: needed (==0.8.6), 0.9 found (latest applicable is 0.8.6)
    needed for package: music-haskell-0.1.0.0

Recommended action: try adding the following to your extra-deps in /Users/.../src/music-haskell/stack.yaml
- api-builder-0.11.0.0

You may also want to try the 'stack solver' command

当我运行stack solver时,我收到有关http-types包的错误

cabal: Could not resolve dependencies:
trying: music-haskell-0.1.0.0 (user goal)
next goal: http-types (dependency of music-haskell-0.1.0.0)
rejecting: http-types-0.9 (conflict: music-haskell => http-types==0.8.6)
rejecting: http-types-0.8.6, 0.8.5, 0.8.4, 0.8.3, 0.8.2................
(global constraint requires ==0.9)
Dependency tree exhaustively searched.

据我所知,看起来我已经安装了http-types-0.9,但现在我需要http-types-0.8.6。我最初尝试使用$stack install http-types手动安装它,但我收到以下错误:

Error parsing targets: Specified target version 0.8.6 for package http-types does not match snapshot version 0.9

当我查看是否可以执行$ stack uninstall时,看起来它已被弃用。

如何摆脱http-type ??

的快照/全局目标

1 个答案:

答案 0 :(得分:3)

您可以通过extra-deps覆盖stack.yaml文件中的特定快照包,例如:

extra-deps:
- http-types-0.8.6

一旦开始包含具有冲突版本边界的软件包与您正在使用的快照相比,您最终可能会很快遇到这些问题。我推荐的解决方案是:

  • 要求软件包维护人员将他们的软件包放入Stackage,这样你就不必手动操作版本
  • 尽可能坚持使用Stackage中的软件包

即使您不是作者,也可以自行向Stackage添加包。有关说明,请参阅the maintainer guide