为了打印非常垂直的树,我搜索了谷歌并找到了一个软件包漂亮树。
我想导入这个包,但问题是:
似乎堆叠LTS不包括这个包。
因此,当我将pretty-tree添加到package.yaml和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是什么,从哪里来?
堆栈文档说
extra
此字段允许您在快照定义的基础上指定额外的依赖项(在上面提到的解析器字段中指定)。这些依赖项可能来自本地文件路径或Pantry包位置。
对于本地文件路径情况,适用于包的相同的相对路径规则。
Pantry包位置允许您包含三种不同来源的依赖关系:
刺伤
档案(tarball或zip文件,本地或通过HTTP(S))
Git或汞储存库但我不知道储藏室是什么。
1. Download pretty-tree-0.1.0.0.tar.gz from [https://hackage.haskell.org/package/pretty-tree](https://hackage.haskell.org/package/pretty-tree)
2. unzip it to my project folder.
3. Add `pretty-tree-0.1.0.0` to `stack.yaml`包裹:-。-漂亮的树-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吗?例如:
外挂:- url:https://hackage.haskell.org/package/pretty-tree-0.1.0.0/pretty-tree-0.1.0.0.tar.gz
我试一试,堆栈提示一个错误:
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错误消失了但我不知道为什么..。
发布于 2020-04-21 13:07:39
pretty-tree-0.1.0.0@sha256:49b0e17008f9d30328db2bcc2958f3a7b78d154d2335c2dbaa2073e237b524ae, 688是什么,从哪里来?您所包含的这长串文本是对包版本的描述。pretty-tree是包名,0.1.0.0是您使用的版本,49b0e17008f9d30328db2bcc2958f3a7b78d154d2335c2dbaa2073e237b524ae是包的Cabal文件的SHA256哈希,688是Cabal文件的大小。(源:https://docs.haskellstack.org/en/stable/pantry/)实际上您只需要包含pretty-tree-0.1.0.0位,其余的就不需要了,但是如果包含它,Stack会使用它进行验证,通过检查每次都会下载相同的包来确保构建是可复制的。
但我不知道储藏室是什么。
储藏室只是Stack用来指定Stack版本的内部组件。为了使用Stack,您不需要知道Pantry是什么或者它是如何工作的,但是如果您感兴趣,可以参考https://docs.haskellstack.org/en/stable/pantry/获得更多信息。
还有另一种解决这个问题的方法--…下载
pretty-tree-0.1.0.0.tar.gz
我不知道你为什么要这么做:这就是Stack在安装软件包时所做的事情,但是如果你手动安装它,你就有更大的机会把它搞砸。
我可以直接将这个链接
https://hackage.haskell.org/package/pretty-tree-0.1.0.0/pretty-tree-0.1.0.0.tar.gz添加到stack.yaml吗?
同样,我也不完全是您想要这样做的原因,因为Stack在指定pretty-tree-0.1.0.0时无论如何都会从这个位置下载包。但令人惊讶的是,事实证明,如果你真的想这样做的话,你真的可以做到!使用extra-deps,您似乎可以执行以下操作:
extra-deps:
- url: https://hackage.haskell.org/package/pretty-tree-0.1.0.0/pretty-tree-0.1.0.0.tar.gz(未经测试,但这应该有效。如果没有,您可能需要按照链接文档添加一个subdirs:部分。)
https://stackoverflow.com/questions/61341717
复制相似问题