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

孤街醉人 提交于 2019-12-03 10:07:23

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/42395931/how-to-use-import-a-personal-library-in-another-project-with-stack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!