"options are incompatible" 运行 'stack ghci' 时出错

"options are incompatible" error when running 'stack ghci'

我是 运行 命令 $ stack ghci azara-api:azara-test,试图在导入我的测试时输入 ghci repl。 (我的项目名称是 azara-api,我的测试套件名称是 azara-test。)

$ stack ghci azara-api:azara-test
azara-api-0.1.0.0: configure (lib + exe)
Configuring azara-api-0.1.0.0...
azara-api-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 -O0
Configuring GHCi with the following packages: azara-api
Using main module: 1. Package `azara-api' component test:azara-test with main-is file: /home/matthew/backup/azara_work/platform/api/test/Spec.hs
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package azara-api-0.1.0.0
    (use -v for more information)

我不知道如何克服这个错误。 这个错误是什么意思?

我在使用 nixos 17.03。

不幸的是,这是一个已知错误 - https://github.com/commercialhaskell/stack/issues/2790。我知道这似乎微不足道,但由于事情的实施方式,修复起来非常棘手。

目前的解决方法是将库也加载到 ghci - stack ghci azara-api:lib azara-api:azara-test,或者可能更简单 stack ghci --test.

另一种选择是先通过 stack build 构建库。那么stack ghci应该可以正常工作