阴谋集团安装解决依赖关系时遇到麻烦



我正在按照本教程尝试设置一个Haskell项目:http://shuklan.com/haskell/lec10.html#/0/9

我以前在"阴谋集团安装"中遇到过这个问题。

我收到以下消息。我读书试试'rm -rf ~/.ghc ~/.cabal'。我尝试了一下,再次"阴谋集团安装",以及"阴谋集团新建",但我仍然收到相同的消息。

我该如何解决这个问题?我使用的是 Mac OS X 10.11.4。我可以制作和运行.hs文件和我们的ghci。我从未使用其他编程语言创建过"文件结构"或类似的东西,所以我不熟悉所涉及的内容。

谢谢!!


Please switch to using either the new project style and the new-install
command or the legacy v1-install alias as new-style projects will become the
default in the next version of cabal-install. Please file a bug if you cannot
replicate a working v1- use case with the new-style commands.
For more information, see: https://wiki.haskell.org/Cabal/NewBuild
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: FirstCabalInit-0.1.0.0 (user goal)
[__1] next goal: base (dependency of FirstCabalInit)
[__1] rejecting: base-4.12.0.0/installed-4.1... (conflict: FirstCabalInit =>
base==4.6.*)
[__1] rejecting: base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0,
base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0,
base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1,
base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0,
base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0,
base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from
non-upgradeable package requires installed instance)
[__1] fail (backjumping, conflict set: FirstCabalInit, base)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, FirstCabalInit ```

您可以在Haskell中找到以下构建工具的指南:

  • https://kowainik.github.io/posts/2018-06-21-haskell-build-tools

根据错误消息,看起来在您的.cabal文件中有一行类似

build-depends: base == 4.6.*

此版本的标准库base非常旧,它对应于GHC-7.6,但是,根据错误消息,您已安装GHC-8.6.5。由于base版本与 GHC 捆绑在一起,因此您不能将base用于未安装的 GHC。请参阅以下匹配的base和 GHC 版本列表:

  • https://wiki.haskell.org/Base_package

看起来您的错误可以通过以下修复来解决:

build-depends: base == 4.12.*

对于将来,我可以建议使用ghcup工具来管理macOS上的GHC和cabal-install版本:

  • https://www.haskell.org/ghcup/

或者,您可以使用stack构建工具,它在沙盒位置为您管理 GHC 版本。

著名的"阴谋集团地狱"。

您最好使用最新的包管理器 https://docs.haskellstack.org/en/stable/README/。

最新更新