What's the difference between `stack install NAME` and `NAME` in the build-depends of project.cabal file?

前端 未结 1 1114
渐次进展
渐次进展 2021-01-19 08:00

What is the difference between adding package_name under the build-depends: section in a project\'s .cabal file, versus doing st

相关标签:
1条回答
  • 2021-01-19 08:43

    stack install will just install the package to the appropriate place (the current snapshot database for libraries in Stackage, the sandbox in ./.stack-work for other libraries, ~/.local/bin or your system's equivalent thereof for executables). Adding a library to build-depends specifies it as a dependency of your project, and leads to the library being installed next time you do a stack build. If you are actually using the library in your project you must add it to build-depends, otherwise you won't be able to build the project (or even play with the library using stack ghci).

    N.B.: As of stack-0.1.3.1, stack install NAME is just a synonym for stack build --copy-bins NAME. The --copy-bins option tells stack to copy any executables to ~/.local/bin. If your package is just a library with no executables, stack install NAME is the same as stack build NAME.

    0 讨论(0)
提交回复
热议问题