Cabal:用源代码构建dir [英] Cabal: build dir with source
问题描述
我有一个 src
目录。在这个目录中,我有 Main.hs
文件和 Test
目录。在 Test
目录中,我有 Test.hs
模块。我需要用cabal进行编译。
在我的cabal文件中,我有:
可执行主
- 包含主模块的.hs或.lhs文件。
Main-is:src / Main.hs
和
- 此包未导出的模块。
其他模块:Test.Test
当我做 cabal配置
没关系,但是当我尝试 cabal build
时出现以下错误:
cabal build
为main-0.0.1 ...
预处理可执行文件cabal:无法找到Test / Test的源代码。dist / build / autogen
我该如何正确构建 Main.hs
和其他一些包含 .hs
文件的目录
谢谢。
<如果 Test.Test
定义在 src / Test / Test.hs 中定义, / code>,您需要
hs-source-dirs:src
Cabal文件的Executable部分中的
。请注意,您的 main-
文件路径应该相对于源目录,所以在这种情况下,您应该将其更改为 Main.hs
。
I have a src
directory. In this directory I have Main.hs
file and Test
directory. In the Test
directory I have Test.hs
module. I need to compile it with cabal.
In my cabal file I have:
Executable main
-- .hs or .lhs file containing the Main module.
Main-is: src/Main.hs
and
-- Modules not exported by this package.
Other-modules: Test.Test
When I do cabal configure
it's OK, but when I try to cabal build
I get the following error:
cabal build
Preprocessing executables for main-0.0.1...
cabal: can't find source for Test/Test in ., dist/build/autogen
How can I correctly build Main.hs
and some other directories with .hs
files?
Thank you.
If Test.Test
is defined in src/Test/Test.hs
, you need
hs-source-dirs: src
in the Executable section of your Cabal file. Note that your main-is
file path should be relative to the source directory, so in this case, you should change it to Main.hs
.
这篇关于Cabal:用源代码构建dir的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!