3

My Haskell file (pretty sure this is not the problem) is basically:

import System.IO
...

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

...

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

My Setup.hs:

import Distribution.Simple
main = defaultMain

My 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

When I run cabal haddock --executables I get

...
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

and the HTML contains main but no documentation for it. It does not even contain functions I defined other than main. Why is that?

4

1 回答 1

6

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

module Main (main, Word) where
于 2014-09-12T05:17:36.487 回答