[Haskell-beginners] Package Documentation (Haddock)

Daniel Fischer daniel.is.fischer at web.de
Thu Nov 18 14:46:59 EST 2010


On Thursday 18 November 2010 20:25:26, Bastian Erdnüß wrote:
> Hi,
>
> I found the Haddock documentation to the packages that came with the
> Haskell Platform locally on my machine.
>
> 1) It's a little bit uncomfortable to always pick the right one by hand.
>  Is there a more comfortable way like doing e.g. 'haddock Data.List'
> (that's not working) to direct to the documentation of a certain module?

Sorry, I don't understand what you want.
To view the haddocks, there's an index.html in the docdir, bookmark that in 
your browser and click from there.
If you want to generate haddocks for your project(s) and have it link to 
the modules you used, the simplest way is to create a .cabal file and let 
cabal take care of directing haddock to the installed docs (you can do it 
manually with --read-interface flags, but letting cabal figure out the 
correct flags is easier).

>
> 2) I cannot find the documentation to the packages I post installed with
> cabal.  I tried to build them using e.g. 'cabal haddock Yampa' but
> that's not working.  How do I do it right?

Edit your ~/.cabal/config, set

documentation: True

there, then cabal builds docs for all packages it installs automatically 
(and creates a comprehensive index in ~/.cabal/share/doc). Unfortunately, 
it doesn't build docs for packages it previously installed, so you'd have 
to reinstall them or create the haddocks manually [the latter may need 
unpacking the packages]. If you haven't installed many packages yet, 
reinstalling is probably the simpler route.

>
> Thanks for your help in advance,
> Bastian


More information about the Beginners mailing list