[Haddock] Fw: [Haskell-cafe] Haddock API and .haddock interface files questions

Claus Reinke claus.reinke at talk21.com
Sat Nov 20 18:00:17 EST 2010

>>   Push/improve Haddock API and .haddock files usage
>>   http://trac.haskell.org/haddock/ticket/157

>> My immediate need is to find a replacement for scraping
>> Haddock URLs for documented identifiers from Haddock's
>> HTML indices ..
>> I've got a test script that does that from .haddock files, but
>> it copies a lot of code that isn't exported via the API, and
> Could you send me that script so that I can see what we need to add to the 
> API?

It is rather cobbled together, but I've attached it to the ticket.
Comments are thin, don't know whether they are sufficient?
Main use case would be 'haddock-index --installed' (with the
output format under user control, everything else is copied
from non-exposed haddock functionality).

>> Also, the HTML index format has changed recently, forcing
>> this exercise, but now I don't know whether the API is any
>> more stable than the HTML format - if it isn't (I assume the
>> HTML rewrite has settled down now?) perhaps I should just
>> update my HTML-scraping code to avoid heavy dependencies?
> I think the HTML index format will be more stable than the API in the
> near future, but I still think we should try to improve the API to
> meet your goals. Not sure what to do about the heavy dependencies
> however.

For now, I've updated the HTML scraping code, but I'd like to
offer the Haskell code for Haddock indexing as a saner (and
faster) alternative. And once the code is in Haskell, other IDEs
could offer similar functionality as haskellmode for Vim (it
wouldn't surprise me if some of them had written their own
workarounds for accessing Haddock documentation for the
identifier under cursor).

I'd also like to be able to use the same functionality for
documentation lookup in GHCi:


Since Haddock itself already depends on GHC, and Cabal tends
to be available, perhaps those dependencies wouldn't be so bad.
It would be nice if Haddock's API was available whenever Haddock
itself is, and the code for indexing, standard URL construction, and
doc pretty-printing as text were exposed.


PS. I only found the Haddock API by accident (Simon mentioned
    it on that GHC ticket) - shouldn't it be documented in the
    Haddock manual, and perhaps announced somewhere?

More information about the Haddock mailing list