我希望有人告诉我在沙箱中安装 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 沙箱允许您安装任何任意软件包,并将所有依赖项(部分或全部与全局安装的软件包冲突)安装在单独的目录中。
这可能吗?
我想我错过了一些东西。这是 cabal 沙箱的正确用例吗?
看到下面的内容
注意:使用沙箱时,所有包都需要具有一致的依赖关系。
冲突的依赖项
和不一致的依赖项
之间有区别吗?
我尝试了很多教程,包括 this但无法理解如何使用 cabal 沙箱。
最佳答案
在我看来,您下载的 gloss-examples
版本与您的 base
库版本不兼容。有两种方法可以解决此问题:
下载与您的
base
库兼容的版本(可能是较旧的版本)。 The contents page for the package on Hackage在顶部附近有一长串可用版本。也可以使用cabal fetch
来执行此操作 - 我不确定。升级 GHC 以获得更新的
基础
。如果不升级 GHC,通常无法升级base
。
关于haskell cabal 沙箱如何安装软件包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32724130/