为什么没有生成文档?

时间:2014-09-12 04:46:41

标签: haskell documentation haddock

我的Haskell文件(很确定这不是问题)基本上是:

import System.IO
...

-- | Every Word is a String
type Word = String

...

-- | Some documentation for Haddock to see
main :: IO ()
main = do
        ...

我的Setup.hs

import Distribution.Simple
main = defaultMain

我的grade.cabal

name:                grade
version:             0.1.0.0
...
build-type:          Simple
cabal-version:       >=1.8

executable grade
  main-is:             grade.hs
  -- other-modules:       
  build-depends:       base ==4.6.*, split ==0.2.*
  hs-source-dirs:      src

当我运行cabal haddock --executables时,我得到了

...
Haddock coverage:
Warning: Not found in environment: Main.main
  50% (  1 /  2) in 'Main'
Warning: Main: could not find link destinations for:
    Main.main
Documentation created: dist/doc/html/grade/grade/index.html

并且HTML包含main但没有相关文档。它甚至不包含我在main之外定义的函数。那是为什么?

1 个答案:

答案 0 :(得分:6)

您需要添加模块声明以为其生成文档。

module Main (main, Word) where