Suppose I have a library packaged and built using Cabal, and some module Internal is not in my cabal file’s Exposed-modules. Does it then make any difference if I specify a pragma
{-# OPTIONS_HADDOCK hide #-}
at the top of Internal.hs, or is it already automatically hidden according to Haddock?
If it does make a difference, what effect does it have?
It does make a difference if the haddocks of the package are created with the
--internalflag tocabal haddock.If the haddocks are created without the
--internalflag, thehidemodule attribute has no effect: no documentation is created for the module anyway.If
--internalis given, then documentation is created for non-exposed modules except those that specify thehideattribute.In other words, documentation is generated if
hideis not set and either--internalis specified or the module is exported.The use of
--internalforcabal haddockcan be specified withcabal install --haddock-internal, or when manually invokingcabal haddock, or with therunhaskell ./Setup.hs ...interface.Most people just run
cabal installwith the default options, so only few would observe the difference.