为了打印漂亮的垂直树,我搜索了谷歌并找到了一个包pretty-tree。
我想导入这个包,但问题是:
Stackage LTS 似乎不包含此软件包。
所以当我添加pretty-tree
到package.yaml
and时stack build
,它会提示
In the dependencies for quick-sort-0.1.0.0:
pretty-tree needed, but the stack configuration has no specified version (latest matching version is 0.1.0.0)
needed since quick-sort is a build target.
Some different approaches to resolving this:
* Recommended action: try adding the following to your extra-deps in E:\work-category-theory\quick-sort\stack.yaml:
- pretty-tree-0.1.0.0@sha256:49b0e17008f9d30328db2bcc2958f3a7b78d154d2335c2dbaa2073e237b524ae,668
我将此修订添加到stack.yaml
:
extra-deps:
- pretty-tree-0.1.0.0@sha256:49b0e17008f9d30328db2bcc2958f3a7b78d154d2335c2dbaa2073e237b524ae,668
这个问题解决了,我可以成功编译。
问题是 :
是什么
pretty-tree-0.1.0.0@sha256:49b0e17008f9d30328db2bcc2958f3a7b78d154d2335c2dbaa2073e237b524ae, 688
,从哪里来?堆栈文件说
额外的部门
此字段允许您在快照中定义的内容之上指定额外的依赖项(在上面提到的解析器字段中指定)。这些依赖项可能来自本地文件路径或 Pantry 包位置。
对于本地文件路径情况,适用于包的相同相对路径规则适用。
Pantry 包位置允许您包含来自三种不同来源的依赖项:
黑客攻击
存档(本地或通过 HTTP(S) 的 tarball 或 zip 文件)
Git 或 Mercurial 存储库
但我不知道Pantry是什么...
还有另一种方法可以解决此问题。那是
- 从https://hackage.haskell.org/package/pretty-tree下载 pretty-tree-0.1.0.0.tar.gz
- 将其解压缩到我的项目文件夹中。
- 添加
pretty-tree-0.1.0.0
到stack.yaml
packages: - . - pretty-tree-0.1.0.0
上面这个方法也可以解决问题,但是我的问题是:
我可以
https://hackage.haskell.org/package/pretty-tree-0.1.0.0/pretty-tree-0.1.0.0.tar.gz
直接stack.yaml
添加这个链接吗?如以下:extra-deps: - url: https://hackage.haskell.org/package/pretty-tree-0.1.0.0/pretty-tree-0.1.0.0.tar.gz
我试了一下,stack提示错误:
E:\work-category-theory\quick-sort>stack build
Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
boxes > using precompiled package
contravariant > using precompiled package
distributive > using precompiled package
th-abstraction > using precompiled package
transformers-compat > using precompiled package
unordered-containers> using precompiled package
pretty-tree > configure
pretty-tree > Configuring pretty-tree-0.1.0.0...
pretty-tree > build
pretty-tree > Preprocessing library for pretty-tree-0.1.0.0..
pretty-tree > Building library for pretty-tree-0.1.0.0..
pretty-tree > [1 of 1] Compiling Data.Tree.Pretty
pretty-tree > copy/register
pretty-tree > Installing library in C:\sr\snapshots\34184208\lib\x86_64-windows-ghc-8.8.3\pretty-tree-0.1.0.0-KT
aQApPwVahHd2AQwQQQSA
pretty-tree > Registering library for pretty-tree-0.1.0.0..
Received ExitFailure 1 when running
Raw command: "C:\\Users\\Chansey\\AppData\\Local\\Programs\\stack\\x86_64-windows\\ghc-8.8.3\\bin\\ghc-pkg.exe" --user -
-no-user-package-db --package-db "C:\\sr\\snapshots\\34184208\\pkgdb" describe --simple-output distributive --expand-pkg
root
Standard error:
ghc-pkg.exe: C:\sr\snapshots\34184208\pkgdb\th-abstraction-0.3.2.0-D5zRQZUNFcq6kU1WHIrSvs.conf: getModificationTime:Crea
teFile "\\\\?\\C:\\sr\\snapshots\\34184208\\pkgdb\\th-abstraction-0.3.2.0-D5zRQZUNFcq6kU1WHIrSvs.conf": does not exist (
The system cannot find the file specified.)
Progress 7/15
抱歉,由于我对 Haskell 生态系统不是很熟悉,所以这个问题可能很愚蠢。
谢谢。
编辑:
我发现如果我第一次使用
extra-deps:
- pretty-tree-0.1.0.0@sha256:49b0e17008f9d30328db2bcc2958f3a7b78d154d2335c2dbaa2073e237b524ae,668
然后回滚到
extra-deps:
- url: https://hackage.haskell.org/package/pretty-tree-0.1.0.0/pretty-tree-0.1.0.0.tar.gz
错误消失了,但我不知道为什么......