[Haskell-cafe] Re: haddock not finding base lib docs -- $topdir ?

Simon Marlow simonmarhaskell at gmail.com
Tue Dec 5 08:36:10 EST 2006

[ moving to haskell-cafe at haskell.org ]

Claus Reinke wrote:
>> This is due to the way GHC is installed on Windows, the package 
>> database doesn't have hardcoded pathnames, the idea being that you can 
>> move your GHC anywhere in the filesystem and it will still work.
> this is an essential feature (for instance, running GHC from a USB or 
> network drive, or just unpacking snapshots without using installers), 
> please do not start splicing in absolute paths!

Don't worry, we don't intend to do that.

>> Unfortunately this means that Haddock can't find the documentation for 
>> the packages.
> this part I do not understand - if GHC and ghc-pkg can find the 
> packages, why can't Haddock? wouldn't it just be a case of making 
> $topdir be in a fixed relationship to the output of "ghc --print-libdir"?

well yes, but Haddock doesn't invoke 'ghc --print-libdir'.  I think it would be 
better for ghc-pkg to hide $topdir from everyone by replacing it with its value 
in any ghc-pkg output.  After all, $topdir is just a hack to make the GHC tree 
location-independent on Windows, it's not a documented feature of the package 

> or should there be a way to query ghc-pkg for the list of package 
> location roots? as you say, the main docs will be in a known location 
> relative to GHC, but perhaps docs in general should be be in a known 
> location relative to their packages, which ghc-pkg (or other tools for 
> other implementations) should be able to locate?
>> One workaround is to specify the paths by hand, using Haddock's 
>> --read-interface flag.  You're using Haddock via Cabal though, so that 
>> doesn't work too well. The other workaround is to find GHC's 
>> package.conf file and replace the string $topdir with the literal path 
>> ("c:/ghc/ghc-6.6" in your case - perhaps you have to append "/doc" for 
>> the haddock fields, though).
> will all docs be moved into "`ghc --print-libdir`\\doc"?

No.  Docs can be installed wherever you like.  Cabal has a policy for 
installation locations on Windows, which you can override if you want.

 > what about
> local/user package databases?

Same here, you can install things wherever you like.  In fact, installing things 
inside the GHC tree isn't recommended.


More information about the Haskell-Cafe mailing list