2011-12-17 91 views
18

我有一個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文件?

謝謝。

回答

22

如果Test.Testsrc/Test/Test.hs定義,你需要

hs-source-dirs: src 

在卡瓦爾文件的可執行部分。請注意,main-is文件路徑應該與源目錄相關,因此在這種情況下,應將其更改爲Main.hs