
Hi Claus,
Neil: is there any documentation on the output format? i couldn't find the flag in the haddock manual, so i was surprised to see it in haddock --help; it works, though, and does seem to generate modules with implementations removed, and some declarations simplified?
Documentation isn't my strong point :) It was originally only intended to be an internal thing for Hoogle, but it does seem generally useful. Perhaps changing it to --summary, documenting it, and more formally specifying the output format (along with an AST/printer/parser) would be a good plan.
one problem with this is that hoogle.txt is not included with releases, nor are the library sources, so this route won't be available for most ghc users. that is why my Doc.vim, announced earlier today, extracts information somewhat tediously from the haddock html index files that are included at least with windows releases.
You can always download hoogle.txt, or perhaps we could supply summary.txt with the HTML output as the documentation? The GHC people would have to be the ones to decide it - Hugs doesn't ship with documentation anyway. My experience with parsing haddock generated HTML is that its painful, and usually wrong. The indexes might be a bit clearer, but parsing out the type signatures and names was a nightmare.
the haddock --hoogle route has the additional issue that it will miss identifiers without type declarations. you could use ghc itself to provide identifier lists:
ghc-haddock will fix that. Extracting names from the index will also miss those without type signatures.
$ ghc -e ":b Data.Char" digitToInt :: Char -> Int data Char type String = [Char] chr :: Int -> Char
I experimented with this as the means for getting information for Hoogle. It was fine, apart from extracting instances (you needed the instance and the type both to be in scope, which you can't really do, or the instance is missed). The only tip I'd give is make sure you specify -fglasgow-exts, I remember some issue if that was missed with functions that were using # in their name - no idea on the exact issue but that flag fixed it. Thanks Neil