Can I generate Haddock documentation for hidden members. My use case is that I have a type T
that is shown in the signature of some functions. As in e.g. f :: T -> U
, g :: T -> U
. I'd like users of my library to know what T
is used for, but not actually export it. Does it make sense? Is this possible?
One option is to add
{-# OPTIONS_HADDOCK ignore-exports #-}
which will generate Haddock documentation as if there were an empty export list -- i.e., as if everything were exported in the module.
Alternatively, the C preprocessor can be used to hide/show some entries in the Haddock docs. One probably has to invoke haddock with something like this (untested)
haddock --optghc=-cpp --optghc=-DHADDOCK ...
and then, in the haskell source,
{-# LANGUAGE CPP #-}
module M
( export1
, export2
#ifdef HADDOCK
, notExportedButWeWantDocsAnyway
#endif
, export3
) where
...
(I thought that haddock already defined a macro to witness its presence, but I can't find that in its docs. One can always use a user-defined haddock flag. Or maybe it was this one.)