Haskell 依赖地狱

Haskell dependency hell

我正在尝试在 Haskell 项目中包含特定版本的库。该库是住宿加早餐的(用于 martix 操作),但我需要特定版本 0.4.3,它修复了乘法实现的错误。

所以,我的 stack.yaml 看起来像这样:

flags: {}
extra-package-dbs: []
packages:
- .
extra-deps:
- bed-and-breakfast-0.4
- base-4.6.0.1
resolver: lts-12.8

但是我在构建时遇到了这个错误:

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for bed-and-breakfast-0.4:
    base-4.11.1.0 from stack configuration does not match >=4.5 && <4.7  (latest matching version
                  is 4.6.0.1)
needed due to realworldhaskell-0.1.0.0 -> bed-and-breakfast-0.4

Some different approaches to resolving this:


  * Set 'allow-newer: true' to ignore all version constraints and build anyway.

  * Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some
    working build configuration. This can be convenient when dealing with many complicated
    constraint errors, but results may be unpredictable.

  * Recommended action: try adding the following to your extra-deps
    in C:\Users\info\Desktop\Projects\haskell\stack.yaml:

- base-4.6.0.1

我已经完成了建议的操作,但没有解决任何问题。我试过使用不同的解析器来查看我的 GHCi 版本是否有问题,但没有任何效果。解释此类错误消息的最佳方式是什么?我应该如何继续?

编辑:

如果我删除 -base.4.6.0.1 并添加 allow-newer: true 我得到这个:

WARNING: Ignoring out of range dependency (allow-newer enabled): base-4.11.1.0. bed-and-breakfast requires: >=4.5 && <4.7
bed-and-breakfast-0.4: configure
Progress 1/2

--  While building custom Setup.hs for package bed-and-breakfast-0.4 using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.2.0.1_ghc-8.4.3.exe --builddir=.stack-work\distd103d30 configure --with-ghc=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3\bin\ghc.EXE --with-g
hc-pkg=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3\bin\ghc-pkg.EXE --user --package-db=clear --package-db=global --package-db=C:\sr\snapshotsfd1958\pkgdb --package-db=C:\Users\info\Desktop\Projects\haskell\
.stack-work\installc390635\pkgdb --libdir=C:\Users\info\Desktop\Projects\haskell\.stack-work\installc390635\lib --bindir=C:\Users\info\Desktop\Projects\haskell\.stack-work\installc390635\bin --datadir=C:\Users\info\Desktop\Proj
ects\haskell\.stack-work\installc390635\share --libexecdir=C:\Users\info\Desktop\Projects\haskell\.stack-work\installc390635\libexec --sysconfdir=C:\Users\info\Desktop\Projects\haskell\.stack-work\installc390635\etc --docdir=C:
\Users\info\Desktop\Projects\haskell\.stack-work\installc390635\doc\bed-and-breakfast-0.4 --htmldir=C:\Users\info\Desktop\Projects\haskell\.stack-work\installc390635\doc\bed-and-breakfast-0.4 --haddockdir=C:\Users\info\Desktop\Pr
ojects\haskell\.stack-work\installc390635\doc\bed-and-breakfast-0.4 --dependency=array=array-0.5.2.0 --dependency=base=base-4.11.1.0 --dependency=binary=binary-0.8.5.1 --dependency=deepseq=deepseq-1.4.3.0 --dependency=template-hask
ell=template-haskell-2.13.0.0 --extra-include-dirs=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include --extra-lib-dirs=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\min

gw64\bin --extra-lib-dirs=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib --exact-configuration
    Process exited with code: ExitFailure 1
    Logs have been written to: C:\Users\info\Desktop\Projects\haskell\.stack-work\logs\bed-and-breakfast-0.4.log

    Configuring bed-and-breakfast-0.4...
    Cabal-simple_Z6RU0evB_2.2.0.1_ghc-8.4.3.exe: The package has an impossible
    version range for a dependency on an internal library: bed-and-breakfast
    ==0.3.2. This version range does not include the current package, and must be
    removed as the current package's library will always be used.

编辑 2:

好的,所以我猜住宿加早餐库需要 base 4.11.1.0,它包含在 GHCi 6.10.2 中(根据 https://wiki.haskell.org/Base_package),所以我需要一个与之匹配的解析器GHCi 版本。我在哪里可以找到解析器版本?

这是对最新可用 bed-and-breakfast 包的限制:base (>=4.5 && <4.7),这意味着它可能甚至无法使用高于 7.6 的 GHC 版本进行编译。考虑到在 GHC 7.8 之前甚至没有 LTS 快照,你运气不佳。

换句话说,软件包已过时,您的选择是:

  • 提交问题并希望维护者能做些什么
  • 尝试自己使用更新的 ghc
  • 使用不同的包