javascript - 快速、二进制和 zip 存档逃离 cabal hell

标签 javascript haskell cabal

我想使用 haste-compiler 包来做 haskell-to-javascript 的事情:

jsnavely@beefy:~/project$ cabal install haste-compiler
Resolving dependencies...
...
Configuring zip-archive-0.2.3...
Building zip-archive-0.2.3...
Preprocessing library zip-archive-0.2.3...
[1 of 1] Compiling Codec.Archive.Zip ( src/Codec/Archive/Zip.hs, dist/build/Codec/Archive/Zip.o )

src/Codec/Archive/Zip.hs:163:27: Not in scope: `decodeOrFail'
Failed to install zip-archive-0.2.3
cabal: Error: some packages failed to install:
haste-compiler-0.3 depends on zip-archive-0.2.3 which failed to install.
zip-archive-0.2.3 failed during the building phase. The exception was:
ExitFailure 1

我注意到有一个更新版本的 zip-archive 将二进制文件的版本提高到 >= 0.7,它提供了 decodeOrFail 函数。所以我尝试查看 haste-compiler repo并将 zip-archive 版本升级到新的 zip-archive 0.2.3.2。但这没有帮助:

jsnavely@beefy:~/project/haste-compiler$ cabal install
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: haste-compiler-0.3 (user goal)
trying: zip-archive-0.2.3.2/installed-208... (dependency of
haste-compiler-0.3)
trying: ghc-7.6.3/installed-0d1... (dependency of haste-compiler-0.3)
next goal: bin-package-db (dependency of ghc-7.6.3/installed-0d1...)
rejecting: bin-package-db-0.0.0.0/installed-837... (conflict: zip-archive =>
binary==0.7.1.0/installed-961..., bin-package-db =>
binary==0.5.1.1/installed-5b8...)
Dependency tree exhaustively searched.

我还尝试手动安装 zip-archive 和二进制文件,并在沙箱中完成所有这些工作。我不知道该怎么做 - 我真的很想用类型良好的 haskelly goodness 替换我所有的 javascript。我在我的 macbookpro 和我的 linux 机器上遇到了同样的问题,都运行最新的haskell 平台,ghc 版本 7.6.3

最佳答案

你的依赖树看起来有点像这样:

                      ┌────────────────────┐
            ┌─────────┤ haste─compiler─0.3 │
            │ depends └─────────────────┬──┘
            V                           │
      ┌───────────┐                     │ depends
      │ ghc─7.6.3 │                     │
      └─────┬─────┘                     V                   
            │ depends                ┌─────────────────────┐
            V                        │ zip─archive─0.2.3.2 │
┌────────────────────────┐           └───────────┬─────────┘
│ bin─package─db─0.0.0.0 │                       │
└───────────┬────────────┘                       │ depends
            │ depends                            │
            V                                    V
    ┌────────────────┐  conflicts with  ┌────────────────┐
    │ binary─0.5.1.1 │<────────────────>│ binary─0.7.1.0 │
    └────────────────┘                  └────────────────┘

因为重新安装 GHC 可能是不可行的,所以它和它下面的所有内容对我们来说都是“固定的”,我们将不得不尝试更改 zip-archive-0.2.3.2binary-0.7.1.0。让我们看看 haste-compiler-0.3 的约束:

zip-archive

所以它根本没有指定版本。任何都会做。如果我们查看以前版本的 zip-archive,我们会发现版本 0.2.2.1 是对 binary 与已安装的 binary 兼容有限制的最早版本-0.5.1.1 也是基于 Hackage 构建的。因此,您应该如何解决它:

  1. 按顺序取消注册 zip-archive-0.2.3.2binary-0.7.1.0:

    % ghc-pkg unregister zip-archive-0.2.3.2
    % ghc-pkg unregister binary-0.7.1.0
    
  2. 从您的 GHC 库目录中删除这两个包。这取决于您的安装,但请查看 ~/.ghc~/.cabal~/Library/Haskell lib 目录(可能在一两个子目录中),看看您是否可以在其中的某处找到这些包。

  3. 安装 haste-compiler-0.3 并限制 zip-archive 版本:

    % cabal install --constraint='zip-archive==0.2.2.1' haste-compiler==0.3
    

这应该可行,但我自己还没有尝试过,所以它可能会出错。

关于javascript - 快速、二进制和 zip 存档逃离 cabal hell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24337665/

相关文章:

Javascript 获取 Array.forEach 的引用

haskell - 类型级列表的多态构造函数

windows - 运行从Haskell项目构建的exe文件时,停止打开命令提示符

haskell - ghc-mod 安装失败

javascript - 使用输入更新 ng-model 数据

javascript - jquery提交表单错误

javascript - 在 Javascript 中获取元素的转换类属性

haskell - 为什么 foldr 可以处理 Haskell 中的无限列表,而 foldl 不行?

haskell - 一种无需轮询即可在 MVar 上形成 'select' 的方法

haskell - windows下没有cabal的代理标志?