首页 文章

haskell cabal sandbox如何安装包?

提问于
浏览
1

我希望有人告诉我在沙盒中安装 gloss-examples 及其所有依赖项所需的步骤 . 这是我试图做的:

我从hackage下载了 gloss-examples 包 .

当我运行命令后,更改为 ~/gloss/gloss-examples-1.9.4.1

~/gloss/gloss-examples-1.9.4.1$cabal sandbox init

它成功了,所以我发出了命令

~/gloss/gloss-examples-1.9.4.1$cabal install --only-dependencies

但后来我遇到了以下错误:

Resolving dependencies...
cabal: Could not resolve dependencies:
trying: gloss-examples-1.9.4.1 (user goal)
next goal: base (dependency of gloss-examples-1.9.4.1)
rejecting: base-4.5.0.0/installed-c8e... (conflict: gloss-examples =>
base==4.8.*)
rejecting: 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)
Dependency tree exhaustively searched.

Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.

如何仅将此包 gloss-examples 及其所有依赖项安装在沙箱目录中?我想我了解cabal sandbox允许您安装任何包含安装在单独目录中的所有依赖项(部分或全部与全局安装的包冲突)的任意包 . 这甚至可能吗?我想我错过了什么 . 这是cabal沙箱的正确用例吗?看到以下内容

Note: when using a sandbox, all packages are required to have consistent dependencies.

conflicting dependenciesnot consistent dependencies 之间有区别吗?

我尝试了许多教程,包括this,但无法理解如何使用cabal沙箱 .

1 回答

  • 2

    在我看来,您已经下载了与您的 base 库版本不兼容的 gloss-examples 版本 . 有两种方法可以解决这个问题:

    • 下载与您的 base 库兼容的版本(可能是旧版本) . The contents page for the package on Hackage附近有一长串可用版本 . 也可以使用 cabal fetch 来做到这一点 - 我不确定 .

    • 升级GHC以获得更新的 base . 如果不升级GHC,通常无法升级 base .

相关问题