How to get Haddock to generate docs for a directory tree of modules

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get Haddock to generate docs for a directory tree of modules

Brian Hulley
Hi -
I've been looking at the docs for Haddock at
http://haskell.org/haddock/haddock-html-0.7/index.html but I can't seem to
find any option to recursively traverse a directory generating hyperlinked
docs for all modules anywhere in the directory or any sub directory etc.

Is there a simple undocumented flag I'm missing?

Thanks, Brian.

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: How to get Haddock to generate docs for a directory tree of modules

Simon Marlow-5
Brian Hulley wrote:

> I've been looking at the docs for Haddock at
> http://haskell.org/haddock/haddock-html-0.7/index.html but I can't seem
> to find any option to recursively traverse a directory generating
> hyperlinked docs for all modules anywhere in the directory or any sub
> directory etc.
>
> Is there a simple undocumented flag I'm missing?

Haddock doesn't do this on its own, but Cabal can do it (./setup
haddock).  You do have to specify all the modules in the .cabal file
though, so it's not really "traversing a directory".

Cheers,
        Simon
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: How to get Haddock to generate docs for a directory tree of modules

Brian Hulley
Simon Marlow wrote:

> Brian Hulley wrote:
>
>> I've been looking at the docs for Haddock at
>> http://haskell.org/haddock/haddock-html-0.7/index.html but I can't
>> seem to find any option to recursively traverse a directory
>> generating hyperlinked docs for all modules anywhere in the
>> directory or any sub directory etc.
>>
>> Is there a simple undocumented flag I'm missing?
>
> Haddock doesn't do this on its own, but Cabal can do it (./setup
> haddock).  You do have to specify all the modules in the .cabal file
> though, so it's not really "traversing a directory".

Thanks for this suggestion. I've also got things to work quite well by using
the following makefile on a Windows command shell (using a Win32 port of gnu
make and based on a helpful example makefile received offlist):

# Makefile for Haddock docs
GHCFLAGS = -fglasgow-exts -fffi
API_FILES := $(wildcard *.hs)

# preprocess for Haddock
%.haddock:%.hs
    ghc $(GHCFLAGS) -cpp -E -optP-P -D__HADDOCK__ $^ -o docs/$@
# generate docs
docs: $(patsubst %.hs,%.haddock,$(API_FILES))
    haddock -o docs -h $(addprefix docs/, $^)

This works as long as all the subdirectories containing modules are
explicitly listed in API_FILES, and the whole directory tree (including the
docs directory) is manually created (for Windows, since Windows doesn't
automatically create directories that don't exist when it tries to open a
file for writing when the filename contains a path) - not a big problem
since the directory tree only needs to be created once.

Regards, Brian.

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe