Haddock

From MobileRead
Jump to: navigation, search

Haddock is a tool for automatically generating documentation from annotated Haskell source code.

Contents

[edit] Overview

It is primarily intended as a markup language for documenting libraries, but it should be useful for any kind of Haskell code.

Haddock lets you write documentation annotations next to the definitions of functions and types in the source code, in a syntax that is easy on the eye when writing the source code (no heavyweight mark-up). The documentation generated by Haddock is fully hyperlinked - click on a type name in a type signature to go straight to the definition, and documentation, for that type.

Haddock can generate documentation in multiple formats; currently HTML is implemented, and there is partial support for generating LaTeX.

[edit] The language

Any line beginning with -- is a comment and will be ignored by the compiler.

[edit] special Characters

The following characters have special meanings in documentation comments: \, /, ', `, ", @, <. To insert a literal occurrence of one of these special characters, precede it with a backslash (\).

Additionally, the character > has a special meaning at the beginning of a line, and the following characters have special meanings at the beginning of a paragraph: *, -. These characters can also be escaped using \.

[edit] Markup examples

  • paragraphs are just text separated with a blank line.
  • Emphasis may be added by surrounding text with /.../
  • Bold (strong) text is indicated by surrounding it with __...__
  • A bulleted item is represented by preceding a paragraph with either “*” or “-”.
  • An enumerated list is similar, except each paragraph must be preceded by either “(n)” or “n.”
  • A URL can be included in a documentation comment by surrounding it in angle brackets: <...> an optional label can be included separated from the URL with a space.
  • An image can be included in a documentation comment by surrounding it in double angle brackets: <<...>> an optional label is also allowed.
  • A heading begins with =. Multiple ='s can be used for lower level headings.
  • Displayed blocks of code are indicated by surrounding a paragraph with @...@ or by preceding each line of a paragraph with >

Other markups are supported.

[edit] Tools

  • Pandoc can read/convert Haddock files

[edit] For more information

Personal tools
Namespaces

Variants
Actions
Navigation
MobileRead Networks
Toolbox