how to use a my own Haskell library in a stack project?

Viewed 297

I have a Haskell library I wrote that I compile with stack. I now need to use it in another Haskell stack project. In order to do that, I have added its current version to the extra_deps of my new project's stack.yaml and listed it among the build_depends of one its executables. When I run stack build, however, it obviously tries to download the library from the internet. How do I specify that the library is local and where to find it?

Thanks in advance!

1 Answers

You can use github coordinates in the extra-deps section of your stack.yaml.

extra-deps:
- github: snoyberg/http-client
  commit: a5f4f30f01366738f913968163d856366d7e0342

Then add the dependency in your package.yaml:

dependencies:
- http-client >= 0.1.0.0
Related