3.5. Named chunks of documentation
Prev | Chapter 3. Documentation and Markup | Next

## 3.5. Named chunks of documentation

Occasionally it is desirable to include a chunk of documentation which is not attached to any particular Haskell declaration. There are two ways to do this:

- The documentation can be included in the export list directly, e.g.:

      module Foo (
         -- * A section heading

         -- | Some documentation not attached to a particular Haskell entity
         ...
       ) where

- If the documentation is large and placing it inline in the export list might bloat the export list and obscure the structure, then it can be given a name and placed out of line in the body of the module. This is achieved with a special form of documentation annotation “`-- $`”:

      module Foo (
         -- * A section heading

         -- $doc
         ...
       ) where

      -- $doc
      -- Here is a large chunk of documentation which may be referred to by
      -- the name $doc.

  The documentation chunk is given a name, which is the sequence of alphanumeric characters directly after the “`-- $`”, and it may be referred to by the same name in the export list.

Prev | Up | Next
3.4. Controlling the documentation structure | Home | 3.6. Hyperlinking and re-exported entities