Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add an external Haskell package to a stack project?

I would like to add req to my Stack project. I can install this on my machine with stack install req but I would like to list this in the project dependencies so it is downloaded when the project is built if it is currently not installed.

stack.yaml looks like the place to do this but I couldn't find any info on how it's done.

like image 252
Qwertie Avatar asked Oct 25 '25 04:10

Qwertie


1 Answers

In your stack.yaml file, under the extra-deps section, add your dependency. Example:

extra-deps:
- req-1.0.0

Note that you specify the version in the extra-deps if that's not in that particular stackage resolver (the resolver is specified in the stack.yaml file in the field resolver). In case, it's present in the stackage resolver - all you have to do is specify that package name under build-depends section in your cabal file (or the package.yaml file if you are using hpack).

More documentaion is available here.

like image 156
Sibi Avatar answered Oct 26 '25 19:10

Sibi