Invoking Haddock ================ Haddock is invoked from the command line, like so: .. code-block:: none haddock [option ...] file ... Where each ``file`` is a filename containing a Haskell source module (.hs) or a Literate Haskell source module (.lhs) or just a module name. 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 identifiers it couldn't resolve. The modules should *not* be mutually recursive, as Haddock don't like swimming in circles. Note that while older version would fail on invalid markup, this is considered a bug in the new versions. If you ever get failed parsing message, please report it. You must also specify an option for the output format. Currently only the :option:`--html` option for HTML and the :option:`--hoogle` option for outputting Hoogle data are functional. The packaging tool `Cabal `__ has Haddock support, and is often used instead of invoking Haddock directly. The following options are available: .. option:: -B Tell GHC that its lib directory is dir. Can be used to override the default path. .. option:: -o --odir= Generate files into dir instead of the current directory. .. option:: -l --lib= Use Haddock auxiliary files (themes, javascript, etc...) in dir. .. option:: -i --read-interface= -i , --read-interface=, -i ,, --read-interface=,, Read the interface file in file, which must have been produced by running Haddock with the :option:`--dump-interface` option. The interface describes a set of modules whose HTML documentation is located in docpath (which may be a relative pathname). The docpath is optional, and defaults to “.”. The srcpath is optional but has no default value. This option allows Haddock to produce separate sets of documentation with hyperlinks between them. The docpath 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 docpath means that a documentation subtree can still be moved around without breaking links. Similarly to docpath, srcpath is used generate cross-package hyperlinks but within sources rendered with :option:`--hyperlinked-source` option. Multiple :option:`--read-interface` options may be given. .. option:: -D --dump-interface= 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 :option:`--read-interface` option for more details. The interface file is in a binary format; don't try to read it. .. option:: --show-interface= Dumps a binary interface file to stdout in a human readable fashion. Uses json as output format. .. [1] Haddock interface files are not the same as Haskell interface files, I just couldn't think of a better name. .. option:: --html, -h Generate documentation in HTML format. Several files will be generated into the current directory (or the specified directory if the :option:`-o` option is given), including the following: ``module.html``; ``mini_module.html`` An HTML page for each module, and a "mini" page for each used when viewing their synopsis. ``index.html`` The top level page of the documentation: lists the modules available, using indentation to represent the hierarchy if the modules are hierarchical. ``doc-index.html``; ``doc-index-X.html`` The alphabetic index, possibly split into multiple pages if big enough. ``some.css``; ``etc...`` Files needed for the themes used. Specify your themes using the :option:`--theme` option. ``haddock-util.js`` Some JavaScript utilities used to implement some of the dynamic features like collapsible sections. .. option:: --latex Generate documentation in LaTeX format. Several files will be generated into the current directory (or the specified directory if the :option:`-o` option is given), including the following: ``package.tex`` The top-level LaTeX source file; to format the documentation into PDF you might run something like this: :: $ pdflatex package.tex ``haddock.sty`` The default style. The file contains definitions for various macros used in the LaTeX sources generated by Haddock; to change the way the formatted output looks, you might want to override these by specifying your own style with the :option:`--latex-style` option. ``module.tex`` The LaTeX documentation for each module. .. option:: --latex-style=