stack repl 是否应该从 *other* 包中加载测试模块?
Should stack repl load test modules from *other* packages?
我有一个项目引入了两个本地包。我的 stack.yaml
有:
packages:
- '.'
- '../creatur-wains'
- '../creatur-wains-test-utils'
creatur-wains
和creatur-wains-test-utils
都定义了一个名为ALife.Creatur.Wain.TestUtils
的模块,但在creatur-wains
中它只是测试代码的一部分,不是库的一部分。当我使用 ghci 时,这不是问题。我可以加载两个包,但只有 creatur-wains-test-utils
中的 TestUtils
版本可见。
然而,Stack 似乎也从 creatur-wains
中提取测试模块,所以我得到以下错误:
$ stack repl
The following GHC options are incompatible with GHCi and have not been passed to it: -Werror -threaded
Configuring GHCi with the following packages: creatur-dvector-wains, creatur-wains-test-utils, creatur-wains
* * * * * * * *
The following modules are present in multiple packages:
* ALife.Creatur.Wain.TestUtils (in creatur-wains, creatur-wains-test-utils)
* * * * * * * *
Not attempting to start ghci due to these duplicate modules.
Use --no-load to try to start it anyway, without loading any modules (but these are still likely to cause errors)
我可以使用 --no-load
解决这个问题,然后一个一个地添加包,但这有点乏味。这是 stack repl
所希望的行为,还是一个错误?
来自 stack ghci
文档 (https://docs.haskellstack.org/en/stable/ghci/):
Similarly to stack build, the default is to load up ghci with all libraries and executables in the project.
因此,要仅加载一个包,您需要执行 stack ghci creatur-wains
。
我有一个项目引入了两个本地包。我的 stack.yaml
有:
packages:
- '.'
- '../creatur-wains'
- '../creatur-wains-test-utils'
creatur-wains
和creatur-wains-test-utils
都定义了一个名为ALife.Creatur.Wain.TestUtils
的模块,但在creatur-wains
中它只是测试代码的一部分,不是库的一部分。当我使用 ghci 时,这不是问题。我可以加载两个包,但只有 creatur-wains-test-utils
中的 TestUtils
版本可见。
然而,Stack 似乎也从 creatur-wains
中提取测试模块,所以我得到以下错误:
$ stack repl
The following GHC options are incompatible with GHCi and have not been passed to it: -Werror -threaded
Configuring GHCi with the following packages: creatur-dvector-wains, creatur-wains-test-utils, creatur-wains
* * * * * * * *
The following modules are present in multiple packages:
* ALife.Creatur.Wain.TestUtils (in creatur-wains, creatur-wains-test-utils)
* * * * * * * *
Not attempting to start ghci due to these duplicate modules.
Use --no-load to try to start it anyway, without loading any modules (but these are still likely to cause errors)
我可以使用 --no-load
解决这个问题,然后一个一个地添加包,但这有点乏味。这是 stack repl
所希望的行为,还是一个错误?
来自 stack ghci
文档 (https://docs.haskellstack.org/en/stable/ghci/):
Similarly to stack build, the default is to load up ghci with all libraries and executables in the project.
因此,要仅加载一个包,您需要执行 stack ghci creatur-wains
。