Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a package using stack?

People also ask

Where does stack install packages?

Stack installs the Stackage libraries in ~/. stack and any project libraries or extra dependencies in a . stack-work directory within each project's directory.

How do I know if stack is installed?

html -> click on system information-> login with admin rights -> you can get all details about the installed server.

Where does stack install GHC?

In its default configuration, Stack will simply ignore any system GHC installation and use a sandboxed GHC that it has installed itself. You can find these sandboxed GHC installations in the ghc-* directories in the stack path --programs directory.


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.


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


This documentation worked for me

On package.yaml add the library under dependencies, for example:

dependencies:
- base >= 4.7 && < 5
- hakyll # added here