【问题标题】:Cabal: build dir with sourceCabal:使用源代码构建目录
【发布时间】:2014-06-29 01:18:42
【问题描述】:

我有一个src 目录。在这个目录中,我有Main.hs 文件和Test 目录。在Test 目录中,我有Test.hs 模块。我需要用 cabal 编译它。

在我的 cabal 文件中,我有:

Executable main
  -- .hs or .lhs file containing the Main module.
      Main-is: src/Main.hs  

  -- Modules not exported by this package.
     Other-modules: Test.Test

当我执行 cabal configure 时没问题,但是当我尝试执行 cabal build 时,我收到以下错误:

cabal build
Preprocessing executables for main-0.0.1...
cabal: can't find source for Test/Test in ., dist/build/autogen

如何正确构建Main.hs 和其他一些带有.hs 文件的目录?

谢谢。

【问题讨论】:

    标签: haskell cabal


    【解决方案1】:

    如果Test.Test定义在src/Test/Test.hs中,则需要

    hs-source-dirs: src
    

    在 Cabal 文件的 Executable 部分。请注意,您的main-is 文件路径应该是相对于源目录的,因此在这种情况下,您应该将其更改为Main.hs

    【讨论】:

      猜你喜欢
      • 2017-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-31
      • 1970-01-01
      • 2015-12-28
      • 2012-12-21
      • 1970-01-01
      相关资源
      最近更新 更多