I have a Haskell project that's built with Stack.
In my Cabal file, I've added a bunch of libraries as dependencies, tls for example.
Is there a command to get the version of a specific library used in my project?
I know from stack.yaml that I'm using the resolver lts-14.16. I could therefore visit the page of this LTS on Stackage and look for the version number of my library there. But I hope there's a more straightforward way, using the command line, to do this.
stack ls dependenciesThis command lists the dependencies and their versions of the current project, as mentioned here. It produces output like the following:
StateVar 1.2
aeson 1.4.6.0
ansi-terminal 0.9.1
array 0.5.3.0
asn1-encoding 0.9.6
asn1-parse 0.9.5
asn1-types 0.3.3
async 2.2.2
attoparsec 0.13.2.3
base 4.12.0.0
Use grep to pick the library you're interested in:
stack ls dependencies 2>/dev/null | grep "^tls"
We use 2>/dev/null to silence any warnings that Stack might produce regarding the project.
If you want to go further and visualize your dependencies, as a graph or tree for instance, use stack dot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With