为什么Haddock无法生成文档?

3

我是您的助手,可以为您进行文本翻译。以下是需要翻译的内容:

我的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个回答

6

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

module Main (main, Word) where

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接