无法为 Haskell 安装 Lattices

Can't install Lattices for Haskell

我正在尝试关注 instructions for installing the Haskell components required by Quipper; but, working from a fresh installation of Haskell using the binary installer

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

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

但是我遇到了以下错误:

Lattices-0.0.1 failed during the building phase. The exception was: ExitFailure 1

如果我尝试继续 Quipper install instructions:

cabal install zlib
cabal install easyrender

我遇到更多错误:

cabal: Could not resolve dependencies:

我不确定如何进行。我该怎么做才能完成 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; Xcode6.4; CLT:6.4.0.0.1.1435007323;铿锵声:6.1 构建 602; Haskell GHC:7.10.2. Using Homebrew in general, but, following what appears to be Homebrew's recommendation,不适用于 Haskell。

Lattices-0.0.1 的源代码与 GHC 7.10.1 或更高版本中包含的 base 的较新版本不兼容,后者现在包含 Applicative Functor 运算符 (<$>)、[=默认为 16=]、(*>)(<*)

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 软件包是很久以前创建的,它的源代码与您通过 [=25= 安装的最新版本的 GHC & base 不兼容].如果你 look at the source 你可以看到数学包导入中使用了 *> 运算符。但是鉴于从 Applicative Functor 模块隐式导入 *>,现在存在命名歧义,这在 base 的早期版本中不存在。这会导致编译错误。

要正确编译 Lattice-0.0.1 包,您需要使用早于 GHC 7.10.1.

的 GHC 版本

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

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

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