Haddock reports missing documentation for instances based on whether there is an explicit export list or not.
Consider the following example:
Main.hs
class Foo a
instance Foo Int
-- | Main method
main :: IO ()
main = undefined
With GHC 7.10.3 and haddock 2.16.1, I get:
> haddock Main.hs
Haddock coverage:
50% ( 1 / 2) in 'Main'
Missing documentation for:
Module header
Warning: Main: could not find link destinations for:
IO
If I add a module export line thusly:
module Main where
class Foo a
instance Foo Int
-- | Main method
main :: IO ()
main = undefined
> haddock Main.hs
Haddock coverage:
25% ( 1 / 4) in 'Main'
Missing documentation for:
Module header
Foo (Main.hs:3)
(Main.hs:5)
Warning: Main: could not find link destinations for:
Int IO
So adding module Main where resulted in an unexpected "missing documentation" report for instance Foo Int. If I change the module line to module Main (main, Foo(..)) where (i.e., explicitly export everything), then haddock no longer complains about missing docs for the instance:
>haddock Main.hs
Haddock coverage:
33% ( 1 / 3) in 'Main'
Missing documentation for:
Module header
Foo (Main.hs:3)
Warning: Main: could not find link destinations for:
IO Int
When is haddock supposed to report missing docs for instances?
Since instances are always exported, why does haddock treat explicit export lists differently from implicit exports?