How to install a package using stack?
33,781
Solution 1
add hakyll in stack.yaml generated by stack init
or stack new
yaml file should look like:
flags: {}
packages:
- '.'
extra-deps:
- hakyll-4.7.1.0
resolver: lts-2.15
after that, run stack solver
installs it
https://github.com/commercialhaskell/stack/wiki/stack.yaml
Solution 2
This documentation worked for me
On package.yaml
add the library under dependencies
, for example:
dependencies:
- base >= 4.7 && < 5
- hakyll # added here
Author by
Ben
Updated on July 05, 2022Comments
-
Ben almost 2 years
Using cabal, I could install hakyll with the command:
cabal install hakyll
How can I do the same thing using stack?
-
Michael Snoyman almost 9 yearsProbably worth adding that
stack install hakyll
all by itself is probably sufficient to get the desired result. -
JoL about 7 yearsI think it's worth mentioning that this method is typically only done when the desired version of the package is not present in the selected snapshot. I believe the preferred method of package installation for a project is adding it to the
*.cabal
file'sbuild-depends
, or runningstack install hakyll
to test it out first. -
Shawn Eary over 2 yearsFor some reason I feel recent versions of GHC have gotten unnecessarily complicated. I used to be able to use cabal. Now I have to go through all of this mess (and more) to get my old programs to compile.