Haskell 如何在stack ghci中使用自定义前奏曲?
我添加了一个定制的前奏曲,它在Haskell 如何在stack ghci中使用自定义前奏曲?,haskell,haskell-stack,ghci,Haskell,Haskell Stack,Ghci,我添加了一个定制的前奏曲,它在堆栈构建和堆栈测试中运行良好。但是,stack ghci不喜欢它,因为它似乎试图一次加载所有这些: $ stack --nix ghci XXX-0.1.0.0: initial-build-steps (lib + exe) The following GHC options are incompatible with GHCi and have not been passed to it: -threaded Configuring GHCi with the
堆栈构建
和堆栈测试
中运行良好。但是,stack ghci
不喜欢它,因为它似乎试图一次加载所有这些:
$ stack --nix ghci
XXX-0.1.0.0: initial-build-steps (lib + exe)
The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
Configuring GHCi with the following packages: XXX
* * * * * * * *
Error: Multiple files use the same module name:
* Prelude found at the following paths
* XXX/server/Prelude.hs (XXX:exe:XXX.exe)
* XXX/src/Prelude.hs (XXX:lib)
* XXX/tests/Prelude.hs (XXX:exe:tests.exe)
* * * * * * * *
Not attempting to start ghci due to these duplicate modules.
首先,解释三个不同的Prelude.hs
文件:它们是相同的,因为其中两个是指向第三个文件的符号链接;我没有想到一个更好的方法来实现这一点,而不可能将我的Prelude.hs
暴露给依赖库
一种可能的解决方法是告诉stack/ghci只加载库代码(在本例中,在
src
下),或者更好的是,告诉它在加载时跳过特定的.hs
文件。如果stack支持它们(?),您可以使用来避免在不导出的情况下复制Prelude
。使用内部库似乎进展得更顺利,但我得到了:无法满足-package Prelude
的要求,例如执行堆栈--nix ghci-v--ghc选项-XNoImplicitPrelude--main是XXX:exe:XXX.exe
(代码>-v)似乎没有显示任何与问题相关的更多信息,添加-XNoImplicitPrelude
也没有改变结果。