【问题标题】:Can't install Lattices for Haskell无法为 Haskell 安装 Lattice
【发布时间】:2015-08-14 16:00:40
【问题描述】:

我正在尝试按照instructions 安装Quipper 所需的Haskell 组件;但是,从全新安装的 Haskell using the binary installer 开始工作。

我在尝试安装 Lattices 软件包时在列表中:

cabal update
cabal install random
cabal install mtl
cabal install primes
cabal install Lattices

但是我遇到了以下错误:

Lattices-0.0.1 在构建阶段失败。例外是:ExitFailure 1

如果我尝试继续Quipper install instructions:

cabal install zlib
cabal install easyrender

我遇到更多错误:

cabal:无法解决依赖关系:

我不确定如何继续。我该怎么做才能完成 Quipper 的软件包安装instructions


Resolving dependencies...
Configuring Lattices-0.0.1...
Building Lattices-0.0.1...
Failed to install Lattices-0.0.1
Build log ( /Users/Roy/.cabal/logs/Lattices-0.0.1.log ):
Configuring Lattices-0.0.1...
Building Lattices-0.0.1...
Preprocessing library Lattices-0.0.1...
[1 of 2] Compiling Math.LinearAlgebra.GramSchmidt ( src/Math/LinearAlgebra/GramSchmidt.hs, dist/build/Math/LinearAlgebra/GramSchmidt.o )

src/Math/LinearAlgebra/GramSchmidt.hs:25:26:
    Ambiguous occurrence ‘*>’
    It could refer to either ‘Prelude.*>’,
                             imported from ‘Prelude’ at src/Math/LinearAlgebra/GramSchmidt.hs:2:8-37
                             (and originally defined in ‘GHC.Base’)
                          or ‘Math.Algebra.LinearAlgebra.*>’,
                             imported from ‘Math.Algebra.LinearAlgebra’ at src/Math/LinearAlgebra/GramSchmidt.hs:7:1-43
cabal: Error: some packages failed to install:
Lattices-0.0.1 failed during the building phase. The exception was:
ExitFailure 1

Resolving dependencies...
cabal: Could not resolve dependencies:
trying: easyrender-0.1.0.1 (user goal)
next goal: base (dependency of easyrender-0.1.0.1)
rejecting: base-4.8.1.0/installed-075... (conflict: easyrender => base>=4.6 &&
<4.8)
rejecting: base-4.8.1.0, 4.8.0.0, 4.7.0.2, 4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0,
4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1,
4.2.0.0, 4.1.0.0, 4.0.0.0, 3.0.3.2, 3.0.3.1 (global constraint requires
installed instance)
Dependency tree exhaustively searched.

OS X 10.10.4; Xcode 6.4; CLT:6.4.0.0.1.1435007323; Clang:6.1 构建 602; Haskell GHC:7.10.2。一般使用 Homebrew,但遵循似乎是 Homebrew's recommendation 的内容,不适用于 Haskell。

【问题讨论】:

  • 注意:我是 Haskell 的新手,所以我在 fresh installation 工作,除了执行 instructions specified for configuring Quipper 之外没有使用 Cabal 的经验。
  • 看起来Lattices-0.0.1 的源代码与base 的较新版本不兼容,后者现在默认包含Applicative Functor 运算符(&lt;$&gt;)(&lt;*&gt;)(*&gt;)(&lt;*)
  • @recursion.ninja:你能详细说明一下吗?我能做些什么来解决这个问题。
  • @recursion.ninja:另外,我是否通过使用platform 安装开始了“正确”的方式。我通常使用 Homebrew,但是当我 brew info haskell-platform 时,我得到一个 message 指向平台(它似乎维护得很好并且易于设置)。

标签: haskell installation packaging cabal haskell-platform


【解决方案1】:

我实际上根本不知道有人在使用 Hackage 的 Lattice-0.0.1,所以当上个月有人向我报告这个错误时,我确实在 GitHub 上修复了它,但没有立即发布新版本,因为那没有似乎并不紧急。看来我错了:-)

我已经上传了一个新版本到 Hackage,Lattices-0.0.2,应该可以解决这个问题。

【讨论】:

  • 感谢您成为出色的软件包维护者!
【解决方案2】:

Lattices-0.0.1 的来源与 GHC 7.10.1 或更高版本中包含的 base 的较新版本不兼容,后者现在包括 Applicative Functor 运算符 (&lt;$&gt;)(&lt;*&gt;)(*&gt;)(&lt;*)默认。

在以前的 base 版本中,需要显式导入 Applicative Functor 运算符:

import Control.Applicative ((<$>), (<*>), (*>), (<*))

main = show <$> getArgs -- use the applicative operator(s)

GHC 7.10.1 或更高版本中包含的base 的最新版本中,这些运算符隐含在Prelude 模块中。

-- This is not necessary
-- import Control.Applicative ((<$>), (<*>), (*>), (<*))

main = show <$> getArgs -- use the applicative operator(s)

由于Lattices-0.0.1 包是很久以前创建的,它的源代码与您通过haskell-platform 安装的最新版本的GHCbase 不兼容。如果您 look at the source 您可以看到 *&gt; 运算符是从数学包导入中使用的。但是考虑到从 Applicative Functor 模块中隐式导入 *&gt; 的前奏,现在存在 base 的早期版本中不存在的命名歧义。这会导致编译错误。

要正确编译Lattice-0.0.1 包,您需要使用早于GHC 7.10.1 的GHC 版本。

haskell-platform 维护得很好,不幸的是 Lattices-0.0.1 包没有...

【讨论】:

  • 我如何回溯到旧版本的 GHC?
  • @raxacoricofallapatorius 小心!我会用参考更新我的帖子。
  • 谢谢。不过,这听起来是个坏主意(“小心”让我担心)。也许要做的事情是让我联系 Quipper 的人,看看他们是否能想出一个解决方案。事实上,他们所写的说明不适用于当前的 GHC。
  • @raxacoricofallapatorius 很遗憾Quipper 的开发人员选择了一个未维护的包作为依赖项。一个简单的import Prelude hiding (*&gt;) 可以解决Lattice-0.0.1 包的问题。
  • @raxacoricofallapatorius 同样的问题。对于easyrender 的包约束是base &gt;= 4.6 &amp;&amp; &lt; 4.8。由于您的 base 大于 4.8 它无法找到可接受的 base 包作为依赖项。这是因为GHC 7.10.2 提供了更新版本的base。基本上这些包没有更新以支持最新版本的base... :(
猜你喜欢
  • 1970-01-01
  • 2016-05-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多