[Haskell-cafe] UPDATE: haskellmode for Vim now atprojects.haskell.org (+screencast; -)

Claus Reinke claus.reinke at talk21.com
Tue Apr 7 09:46:11 EDT 2009

Hi Matthijs,

>I've installed the vimball, and it spit a few errors at me. In particular, it
>couldn't find the haddock documentation directory. A quick look at
>haskell_doc.vim shows that it should autodetect the directory. However, for
>some reason my ghc-pkg command returns the doc directory twice:
>  $ ghc-pkg field base haddock-html
>  haddock-html: /usr/local/ghc-6.10.1/share/doc/ghc/libraries/base
>  haddock-html: /usr/local/ghc-6.10.1/share/doc/ghc/libraries/base

Interesting. The reason for the double listing is that recent GHCs come
with two base packages (since the packages differ in content, having
both point to the same documentation location looks wrong to me, btw).

>The haskell_doc.vim contains the following line, which seems to deal with
>multiple lines:
>  let field = substitute(system(g:ghc_pkg . ' field base haddock-html'),'\n','','')

This just used to remove the final '\n', in the days when multiple versions 
of base were still unthinkable. What I'm really after in that part of the script
is the location of the GHC docs, and the library index (the actual package
docs are processed later). Unfortunately, past GHC versions haven't been 
too helpful (#1226, #1878, #1572), hence all that guesswork in my scripts 
(for a while, there was a ghc --print-docdir, but that didn't quite work and 
disappeared quickly, nowadays, there is the nice ghc-paths package, but 
that doesn't give a concrete path for docdir, so I still need to find the http 
top dir for GHC).

I hadn't noticed this change, because (a) the scripts look in "likely suspects" 
for the docs location as well, and (b) the docs location can be configured
(bypassing all that guesswork) by setting 'g:haddock_docdir' before 
loading the scripts (:help g:haddock_docdir, :help haskellmode-settings-fine).

Using g:haddock_docdir to configure the right path for your installation 
is probably the least wrong thing to do for now, and requires no changes
to the scripts, but I'll have a look at how to improve the guesswork code 
for convenience, looking at the first match only or looking for the relevant 
directories in all matches..

Thanks for the report!

More information about the Haskell-Cafe mailing list