I think it is a shortcoming/bug in haddock. Digging a little in the sources, the error message comes from declNames
in Haddock/LaTeX.hs
:
declNames :: LHsDecl DocName -> [DocName]
declNames (L _ decl) = case decl of
TyClD d -> [unLoc $ tcdLName d]
SigD (TypeSig lnames _) -> map unLoc lnames
_ -> error "declaration not supported by declNames"
so the LaTeX backend only supports type class declarations and type signatures, everything else that is passed to declNames
generates the "declaration not supported by declNames"
error.
In the xhtml backend, further declarations are supported:
ForD d -> ppFor summ links loc (mbDoc, fnArgsDoc) d unicode qual
InstD _ -> noHtml
foreign declarations generate output, instance declarations not. Unsupported declarations cause
error "declaration not supported by ppDecl"
in ppDecl
(Haddock.Backends.Xhtml.Decl
).
Instance declarations are not passed to declNames
in the LaTeX backend, so they don't generate an error, but foreign declarations are (if exported).
Since your modules are Foreign.Java.X
, I expect some foreign im- or exports to be exported from some module there, which explains the error.
A bug report/feature request seems called for.