flycheck-haskell和doctest在Cabal 3.0 v2-build项目上不起​​作用 [英] flycheck-haskell and doctest don't work on Cabal 3.0 v2-build project

查看:70
本文介绍了flycheck-haskell和doctest在Cabal 3.0 v2-build项目上不起​​作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Cabal 3.0上创建一个Nix风格的本地构建(v2-build)项目。

但是一些开发工具(flycheck-haskell和doctest)不起作用。

他们在Cabal 2.4上的新建项目上工作。

错误消息说,据我所知,他们找不到依赖项。

I tried to create a Nix-style local build (v2-build) project on Cabal 3.0.
But several development tools (flycheck-haskell and doctest) don't work.
They worked on new-build project on Cabal 2.4.
Error message says they cannot find dependencies, as far as I read.

$ cabal v2-clean
$ cabal v2-build
$ cabal v2-test
Build profile: -w ghc-8.8.1 -O1
In order, the following will be built (use -v for more details):
 - hstest9-0.1.0.0 (test:doctestd) (first run)
Configuring test suite 'doctestd' for hstest9-0.1.0.0..
Preprocessing test suite 'doctestd' for hstest9-0.1.0.0..
Building test suite 'doctestd' for hstest9-0.1.0.0..
[1 of 1] Compiling Main             ( test/doctest-driver.hs, /Users/user/work/hstest9/dist-newstyle/build/x86_64-osx/ghc-8.8.1/hstest9-0.1.0.0/t/doctestd/build/doctestd/doctestd-tmp/Main.o )
Linking /Users/user/work/hstest9/dist-newstyle/build/x86_64-osx/ghc-8.8.1/hstest9-0.1.0.0/t/doctestd/build/doctestd/doctestd ...
Running 1 test suites...
Test suite doctestd: RUNNING...

/Users/user/work/hstest9/src/MyLib.hs:3:1: error:
    Could not find module ‘Control.Effect’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
3 | import Control.Effect
  | ^^^^^^^^^^^^^^^^^^^^^

Test suite doctestd: FAIL
Test suite logged to:
/Users/user/work/hstest9/dist-newstyle/build/x86_64-osx/ghc-8.8.1/hstest9-0.1.0.0/t/doctestd/test/hstest9-0.1.0.0-doctestd.log
0 of 1 test suites (0 of 1 test cases) passed.
cabal: Tests failed for test:doctestd from hstest9-0.1.0.0.


推荐答案

您的文档测试找不到正确的 GHC_ENVIRONEMNT

Your doctest doesn't find proper GHC_ENVIRONEMNT.

从Cabal 3.0开始,cabal v2-build默认不会生成环境文件。

Since Cabal 3.0, cabal v2-build doesn't generate environment files by default.


从Cabal 3.0开始,默认为决不。在此之前,默认情况下仅在使用GHC 8.4.4及更早版本进行编译时才创建它们(GHC 8.4.4是第一个支持-package-env-选项的版本,该选项允许忽略软件包环境文件)。
https://www.haskell.org/cabal/users-guide/nix-local-build.html#cfg-field-write-ghc-environment-files

所以您应该在v2-build上设置此选项。

So you should set this option on v2-build.

$ cabal v2-build --write-ghc-environment-files=ghc8.4.4+

或者您可以将其写在 $ HOME / .cabal / config

write-ghc-environment-files: ghc8.4.4+

这篇关于flycheck-haskell和doctest在Cabal 3.0 v2-build项目上不起​​作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆