[Haddock] Fwd: vim help text export

David Waern david.waern at gmail.com
Sun Jan 15 15:40:02 GMT 2012


---------- Forwarded message ----------
From: David Waern <david.waern at gmail.com>
Date: 2012/1/15
Subject: Re: [Haddock] vim help text export
To: Lars Krueger <lars_e_krueger at gmx.de>


2012/1/15 Lars Krueger <lars_e_krueger at gmx.de>:

>> What do your vim files need to contain? If all they need is doc
>> comments then you should be fine with InstalledInterface (if we add
>> ifaceDoc). But if you for example need the Haskell declarations of a
>> module then writing your backend as a separate program becomes more
>> complicated as you'd have to invoke the GHC API.
>
> I would like to have them as similar to the XHtml files as possible. The markup will be lost, but I want to keep all the declarations including types-as-hyperlinks, etc. Most of the time I need to look up order of parameters or the exact spelling of a struct field. It would be handy to do that right from within vim.

OK, so you can't just rely on InstalledInterface but you need to
invoke Haddock and GHC directly on the original sources through
processModules in order to write your backend as a stand-alone
program.

>> Do you mean GHC.* modules or modules from the ghc package? Another
>
> Modules from the ghc package. Stuff like Alpha.* or X86.*.

Those modules are part of the "exposed-modules" in the ghc package.
The ghc package itself is hidden by default however. You can use
ghc-pkg to get information such as this.

> Another option is to restructure Main.hs such that you can replace the backends. I think of something like this:
>
> Regular haddock Main.hs:
> main = haddockMain [ppXHtmlIndex, ppXHtmlContents, ppXHtmlModules]
>
> My haddock2vimhelp Main.hs
> main = haddockMain [ppVimHelpContents, ppVimHelpModules]
>
> Maybe the command line flags should be a parameter too. I'll check how far I can get with the current haddock API. If something really important is missing, I'll ask.
>
> Maybe you could think about the refactoring above and check with the other developers if that's a way to go.

The long term goal is for Haddock to spit out a file which contains
everything you need (perhaps in combination with GHC's .hi files or
perhaps on its own), and for the Haddock API to be able to read that
file for you and just provide a data strucure.

InstalledInterface is the current light-weight version of that file.

Making Haddock easier to invoke through the API is also useful, but
less so, so I don't think we'll prioritize your idea of a
"haddockMain", although it's a good idea.

David



More information about the Haddock mailing list