How to install a package using stack?
HaskellCabalCabal InstallPackage ManagementHaskell StackHaskell Problem Overview
Using cabal, I could install hakyll with the command:
cabal install hakyll
How can I do the same thing using stack?
Haskell Solutions
Solution 1 - Haskell
stack install hakyll
stack
offers a curated set of packages that won't blow your machine up. If you want to check what packages are available, or exactly what version is supported, or on what version of GHC
you can get it, check out https://www.stackage.org/.
For example, you can get hakyll 4.6.9.0
right now for both GHC 7.8.4
and GHC 7.10.1
. Pretty neat. - source
EDIT: I forgot to mention, Yuan Wang's method works for getting the version of hakyll
that is not curated into stackage
. It's up to you what version you need.
Solution 2 - Haskell
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
Solution 3 - Haskell
This documentation worked for me
On package.yaml
add the library under dependencies
, for example:
dependencies:
- base >= 4.7 && < 5
- hakyll # added here