In order to print pretty vertical tree, I searched google and found a package pretty-tree.
I want to import this package, but the problem is:
It seems that the Stackage LTS does not include this package.
So when I add pretty-tree
to package.yaml
and stack build
, it prompt that
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
I add this revision to stack.yaml
:
extra-deps:
- pretty-tree-0.1.0.0@sha256:49b0e17008f9d30328db2bcc2958f3a7b78d154d2335c2dbaa2073e237b524ae,668
This problem solved and I can complied successfully.
The question is :
What is pretty-tree-0.1.0.0@sha256:49b0e17008f9d30328db2bcc2958f3a7b78d154d2335c2dbaa2073e237b524ae, 688
, where is from?
Stack document says that
extra-deps
This field allows you to specify extra dependencies on top of what is defined in your snapshot (specified in the resolver field mentioned above). These dependencies may either come from a local file path or a Pantry package location.
For the local file path case, the same relative path rules as apply to packages apply.
Pantry package locations allow you to include dependencies from three different kinds of sources:
Hackage
Archives (tarballs or zip files, either local or over HTTP(S))
Git or Mercurial repositories
But I don't know what Pantry is...
There is another way to fix this problem. That is
pretty-tree-0.1.0.0
to stack.yaml
packages:
- .
- pretty-tree-0.1.0.0
This method above can also solve the problem, but my question is:
Can I add this link https://hackage.haskell.org/package/pretty-tree-0.1.0.0/pretty-tree-0.1.0.0.tar.gz
to stack.yaml
directly? Such as following:
extra-deps:
- url: https://hackage.haskell.org/package/pretty-tree-0.1.0.0/pretty-tree-0.1.0.0.tar.gz
I try it, stack prompt a error:
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
Sorry, since I am not very familiar with Haskell ecosystem, this question maybe silly.
Thanks.
Edited:
I found that if I first use
extra-deps:
- pretty-tree-0.1.0.0@sha256:49b0e17008f9d30328db2bcc2958f3a7b78d154d2335c2dbaa2073e237b524ae,668
and then rollback to
extra-deps:
- url: https://hackage.haskell.org/package/pretty-tree-0.1.0.0/pretty-tree-0.1.0.0.tar.gz
The error disappeared, but I don't know why...
- What is
pretty-tree-0.1.0.0@sha256:49b0e17008f9d30328db2bcc2958f3a7b78d154d2335c2dbaa2073e237b524ae, 688
, where is from?
This long string of text you’ve included is a description of a package version. pretty-tree
is the package name, 0.1.0.0
is the version you’re using, 49b0e17008f9d30328db2bcc2958f3a7b78d154d2335c2dbaa2073e237b524ae
is a SHA256 hash of the package’s Cabal file, and 688
is the size of the Cabal file. (Source: https://docs.haskellstack.org/en/stable/pantry/) Really you only need to include the pretty-tree-0.1.0.0
bit; the rest isn’t necessary, but if you do include it, Stack uses it for validation purposes, to ensure that your build is reproducible by checking that it always downloads the same package every time.
But I don't know what Pantry is...
Pantry is simply the internal component which Stack uses to specify Stack versions. You don’t need to know what Pantry is or how it works in order to use Stack, but if you’re interested, you can refer to https://docs.haskellstack.org/en/stable/pantry/ for more information.
There is another way to fix this problem … Download
pretty-tree-0.1.0.0.tar.gz
I have no idea why you would want to do this: this is pretty much exactly what Stack does to install a package, but if you do it manually you have a much greater chance of messing it up.
Can I add this link
https://hackage.haskell.org/package/pretty-tree-0.1.0.0/pretty-tree-0.1.0.0.tar.gz
to stack.yaml directly?
Again, I’m not entirely why you would want to do this, since Stack downloads the package from this location anyway when you specify pretty-tree-0.1.0.0
. But surprisingly, it turns out that you actually can do this if you really want to! Using the documentation for extra-deps
, it appears that you can do the following:
extra-deps:
- url: https://hackage.haskell.org/package/pretty-tree-0.1.0.0/pretty-tree-0.1.0.0.tar.gz
(Untested, but this should work. If it doesn’t, you may need to add a subdirs:
section, as per the linked documentation.)