Question

I'm currently developing small application on Haskell. I have all documented and main too. But cabal haddock --executables show errors:

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

And Main.hs itself:

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

Why haddock can't find documentation for main?

Using ghc-7.0.4, cabal-1.10.2.0 and haddock-2.9.2 on Fedora 17.

Was it helpful?

Solution

Haddock documentation has to be attached to type signatures. Try this:

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

Addition: It's also necessary to add:

module Main(main) where

in the beginning of the Main.hs, this allows haddock to find and document the main function.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top