2012-10-31 17 views
0

我目前正在開發在Haskell small application。我也有所有記錄和main。但cabal haddock --executables顯示錯誤:錯誤的建築黑道文件與cabal

Running Haddock for XComposeChecker-0.1... 
Preprocessing executables for XComposeChecker-0.1... 
Warning: The documentation for the following packages are not installed. No 
links will be generated to these packages: rts-1.0 
haddock coverage for ./XComposeChecker.hs: 8/13 62% 
Warning: Couldn't find TyThing for exported Main.main: main:Main.main; not documenting. 
haddock coverage for dist/build/tmp3599/./Main.hs:  1/2 50% 
Warning: Main: could not find link destinations for: 
    Main.main 
Documentation created: dist/doc/html/XComposeChecker/checker/index.html 

而且Main.hs本身:

import Text.ParserCombinators.Parsec 
import System.Directory 
import System.FilePath 

import XComposeChecker 

-- | Main 
main = do 
     homedir <- getHomeDirectory 
     result <- parseFromFile parseXComposeFile (joinPath [homedir, ".XCompose"]) 
     print result 

爲什麼haddock找不到main文檔?

使用ghc-7.0.4,就Fedora 17cabal-1.10.2.0haddock-2.9.2

回答

3

黑道克文件必須附加到類型簽名。試試這個:

-- | Main 
main :: IO() 
main = do 
    print 3 

增加:這也是必要的補充:

module Main(main) where 

Main.hs的開始,這使得haddock發現和記錄main功能。

+0

我相信現在你可以放棄而不會放下類型簽名。 –