Frage

I am trying to generate API documentation via cabal and haddock. I want it to be latex. So I do:

cabal haddock --haddock-option=--latex

This fails ultimately with:

haddock: internal error: declaration not supported by declNames

Is there something I can do or is something wrong with haddock?

FYI, I have to use cabal since the build process is rather complicated (lots of preprocessors, ffi libraries, ...). Invoking haddock manually is really painful.

Building HTML documentation however is working completely as expected.

The complete output is at http://pastebin.com/xt6rWqde .

I am using:

cabal-install version 0.14.0
using version 1.14.0 of the Cabal library 

The Glorious Glasgow Haskell Compilation System, version 7.4.2

Haddock version 2.11.0, (c) Simon Marlow 2006
Ported to use the GHC API by David Waern 2006-2008
War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top