我有一个项目,它拉入了两个本地包。我的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/(:
与堆栈构建类似,默认设置是使用项目中的所有库和可执行文件加载 ghci。
因此,要仅加载一个包,您需要执行stack ghci creatur-wains
。