hliu
hliu

Reputation: 1047

How to link to a local Haskell library?

There are current two projects with stack and cabal files each (I use stack to build), one is an exe called test and the other is a library called testlib. I want to use testlib in the test project, what can I do to let stack know testlib is a custom library and how to find it?

-- projects/test/test.yaml
-- projects/testlib/testlib.yaml

Upvotes: 3

Views: 319

Answers (2)

Paul Johnson
Paul Johnson

Reputation: 17796

You can use extra-deps or packages according to taste. packages should be used when the extra library (testlib in your example) is part of your development work, and extra-deps when you have a stable release.

The manual has more details.

Upvotes: 2

hliu
hliu

Reputation: 1047

I find the answer.

extra-deps solve the problem.

And the test.yaml seems like:

...
extra_deps:
- ../testlib-1.0.0
...

Two points should be noticed:

  1. the path should be relative to the directory containing test.yaml
  2. the name of target lib should be like LIBNAME-VERINFO1.VERINFO2

Any better solution will be welcome. And thanks a lot for the help!

Upvotes: 6

Related Questions