是否可以使用 Haskell 堆栈从 github 安装一个软件包版本?
例如在 .cabal
或 stack.yaml
文件,如何将依赖项指向 git repo/branch/revision?
最佳答案
对于 <1.11 的堆栈:
documentation for the stack.yaml
packages
section给出了引用更复杂的包位置的示例。
packages: - location: . - location: dir1/dir2 - location: https://example.com/foo/bar/baz-0.0.2.tar.gz - location: http://github.com/yesodweb/wai/archive/2f8a8e1b771829f4a8a77c0111352ce45a14c30f.zip - location: git: git@github.com:commercialhaskell/stack.git commit: 6a86ee32e5b869a877151f74064572225e1a0398 - location: hg: https://example.com/hg/repo commit: da39a3ee5e6b4b0d3255bfef95601890afd80709
然后添加
extra-dep: true
到package
输入只是为了告诉stack
不要将它引入的代码视为您正在开发的东西(例如,不要在 GHCi 中加载它)。
关于来自 github 的 Haskell Stack 安装包依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38377521/