Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use import a personal library in another project with Stack?

So I have a personal stack library, let's call it Foo. In Foo, I have a FooModule module file named FooModule.hs. I have another stack project called Bar. How do I import the FooModule.hs module to project Bar?

like image 616
Gal Avatar asked Feb 22 '17 15:02

Gal


1 Answers

I do this all the time. In your stack.yaml file, add the path to the Foo package:

-- stack.yaml
packages:
- '.'
- lib/foo

And then in your Bar.cabal file you say that your build depends on Foo

-- project.cabal
...
build-depends:       base >= 4.7 && < 5
                   , foo
like image 189
jkeuhlen Avatar answered Oct 10 '22 18:10

jkeuhlen