使用堆栈测试 Hackage 包的工作流程(不在 Stackage 中)
Workflow for using stack to test Hackage packages (not in Stackage)
使用 stack 执行独立下载和安装(用于测试和实验)Haskell 包的工作流程是什么,该包在 Hackage 中,但不在 Stackage 中?
例如
stack new tester
cd tester
# Then add the package PKG to 'extra-deps'
stack build . --force-dirty
是不够的,当尝试包的一部分 import
时会导致错误 ("not a module in the current program, or in any known package")。
使用
显式构建包(这似乎没有必要)
stack build PKG
也不起作用(导致警告它 "is a member of the hidden package PKG...")。
如果我只是
stack new tester --force
cd tester
stack build PKG
当我尝试在 stack ghci
会话中导入包的组件时,我遇到了相同的 "hidden package" 错误。
使用 Haskell 堆栈为在 Hackage 上使用特定包创建隔离的临时安装的(最佳实践)工作流程是什么?
要使用 Stackage 上不可用的包,我通常首先尝试在全局项目中构建它:
$ cd ~/
$ stack build the-package
$ stack ghci
如果这不起作用,通常是因为缺少依赖项或边界问题,我将采用以下工作流程:
$ stack new playground
$ cd playground
# In playground.cabal, add the-package to the library build-depends section
$ stack solver --update-config
$ stack ghci
# Play with the package
使用 stack 执行独立下载和安装(用于测试和实验)Haskell 包的工作流程是什么,该包在 Hackage 中,但不在 Stackage 中?
例如
stack new tester
cd tester
# Then add the package PKG to 'extra-deps'
stack build . --force-dirty
是不够的,当尝试包的一部分 import
时会导致错误 ("not a module in the current program, or in any known package")。
使用
显式构建包(这似乎没有必要)stack build PKG
也不起作用(导致警告它 "is a member of the hidden package PKG...")。
如果我只是
stack new tester --force
cd tester
stack build PKG
当我尝试在 stack ghci
会话中导入包的组件时,我遇到了相同的 "hidden package" 错误。
使用 Haskell 堆栈为在 Hackage 上使用特定包创建隔离的临时安装的(最佳实践)工作流程是什么?
要使用 Stackage 上不可用的包,我通常首先尝试在全局项目中构建它:
$ cd ~/
$ stack build the-package
$ stack ghci
如果这不起作用,通常是因为缺少依赖项或边界问题,我将采用以下工作流程:
$ stack new playground
$ cd playground
# In playground.cabal, add the-package to the library build-depends section
$ stack solver --update-config
$ stack ghci
# Play with the package