Haddock User Guide
Prev |  | Next

# Chapter 2. Invoking Haddock

Haddock is invoked from the command line, like so:

haddock [`option`...] `file`...

Where each `file` is a filename containing a Haskell source module. All the modules specified on the command line will be processed together. When one module refers to an entity in another module being processed, the documentation will link directly to that entity.

Entities that cannot be found, for example because they are in a module that isn't being processed as part of the current batch, simply won't be hyperlinked in the generated documentation. Haddock will emit warnings listing all the indentifiers it couldn't resolve.

The modules should not be mutually recursive, as Haddock don't like swimming in circles.

The following options are available:

`-o` `dir`, `--odir`=`dir`

  Generate files into `dir` instead of the current directory.

`-i` `path`,`file`, `--read-interface`=`path`,`file`

  Read the interface file in `file`, which must have been produced by running Haddock with the `--dump-interface` option. The interface describes a set of modules whose HTML documentation is located in `path` (which may be a relative pathname). The `path` is optional, and defaults to ".".

  This option allows Haddock to produce separate sets of documentation with hyperlinks between them. The `path` is used to direct hyperlinks to point to the right files; so make sure you don't move the HTML files later or these links will break. Using a relative `path` means that a documentation subtree can still be moved around without breaking links.

  Multiple `--read-interface` options may be given.

`-D` `file`, `--dump-interface`=`file`

  Produce an interface file[1] in the file `file`. An interface file contains information Haddock needs to produce more documentation that refers to the modules currently being processed - see the `--read-interface` option for more details. The interface file is in a binary format; don't try to read it.

`-l` `dir`, `--lib`=`dir`

  Use auxiliary files in `dir`.

`-S`, `--docbook`

  Reserved for future use (output documentation in SGML DocBook format).

`-h`, `--html`

  Generate documentation in HTML format. Several files will be generated into the current directory (or the specified directory if the `-o` option is given), including the following:

  `index.html`

    The top level page of the documentation: lists the modules available, using indentation to represent the hierarchy if the modules are hierarchical.

  `haddock.css`

    The stylesheet used by the generated HTML. Feel free to modify this to change the colors or layout, or even specify your own stylesheet using the `--css` option.

  ``module`.html`

    An HTML page for each `module`.

  `doc-index.html`, `doc-index-XX.html`

    The index, split into two (functions/constructors and types/classes, as per Haskell namespaces) and further split alphabetically.

`-m`, `--ms-help`

  (In HTML mode only) Produce extra contents and index files for the Microsoft HTML Help system. The files created will be named `index.hhc` and `index.hhk` respectively.

  Using the Microsoft HTML Help system provides two advantages over plain HTML: the help viewer gives you a nice hierarchical folding contents pane on the left, and the documentation files are compressed and therefore much smaller (roughly a factor of 10). The disadvantages are that the viewer is only available on Windows, and the help can't be viewed over the web.

  In order to create a compiled Microsoft help file, you also need the Microsoft HTML Help compiler, which is available free from http://www.microsoft.com/ (search for "HTML Help compiler").

`-s` `URL`, `--source`=`URL`

  Include links to the source files in the generated documentation, where `URL` is the base URL where the source files can be found.

`-c` `file`, `--css`=`file`

  Specify a stylesheet to use instead of the default one that comes with Haddock. It should specify certain classes: see the default stylesheet for details.

`-p` `file`, `--prologue`=`file`

  Specify a file containing documentation which is placed on the main contents page under the heading “Description”. The file is parsed as a normal Haddock doc comment (but the comment markers are not required).

`-t` `title`, `--title`=`title`

  Use `title` as the page heading for each page in the documentation.This will normally be the name of the library being documented.

  The title should be a plain string (no markup please!).

`-n`, `--no-implicit-prelude`

  Don't automatically import `Prelude` in every module. Used when producing documentation for the `Prelude` itself.

`-d`, `--debug`

  Produce extra debugging output.

`-?`, `--help`

  Display help and exit.

`-v`, `--verbose`

  Increase verbosity. Currently this will cause Haddock to emit some extra warnings, in particular about modules which were imported but it had no information about (this is often quite normal; for example when there is no information about the `Prelude`).

`-V`, `--version`

  Output version information and exit.

`--use-index=`URL``

  When generating HTML, do not generate an index. Instead, redirect the Index link on each page to `URL`. This option is intended for use in conjuction with `--gen-index` for generating a separate index covering multiple libraries.

`--gen-index`

  Generate an HTML index containing entries pulled from all the specified interfaces (interfaces are specified using `-i` or `--read-interface`). This is used to generate a single index for multiple sets of Haddock documentstation.

`-k` `P`, `--package=``P`

  Set the package name for these modules to `P`. In a combined index generated with `--gen-index`, the package name for each module is shown in the right-hand column.

### Notes

[1] | Haddock interface files are not the same as Haskell interface files, I just couldn't think of a better name.

Prev | Home | Next
Acknowledgements |  | Documentation and Markup