root/docs/haddock_tips

Revision 9354, 4.2 kB (checked in by bsb, 3 years ago)

r9347@rex: bsb | 2006-03-07 22:16:10 +0200
Mention haddock vim syntax

  • Property svn:mime-type set to text/plain; charset=UTF-8
  • Property svn:eol-style set to native
Line 
1This is a Quick Reference for
2
3
4Haddock is the POD of Haskell, it's used in the Pugs source to
5document the Haskell code.  "make haskell" generates cross-linked
6html documentation in the ./dist/doc/html directory.
7Haddock is also able to extract type, function and module information
8automatically.
9
10Haddock's homepage is:
11
12  http://www.haskell.org/haddock/
13  http://cvs.haskell.org/darcs/haddock/examples/
14
15An online copy of Pugs haddock output is available at:
16
17  http://nothingmuch.woobling.org/pugs_test_status/haddock/
18
19This document is intended to aid Pugs documentation and code contributors
20who want to get started with a minimum of effort.
21This file is just plain text to avoid requiring any kind of escaping.
22Scan this file for "===" to see the topics covers
23
24POD <=> Haddock Phrase Book
25===========================
26POD                         Haddock
27Paragraph \n\n+ separated   Paragraph also \n\n+ separated
28E<gt>,E<sol>                \>,\/   use \ to escape /, ', `, ", @, <
29                                    or *, - a the start of a line
30  verbatim paragraph        > verbatim paragraph
31L<Perl::Module::function>   'Haskell.Module.function'  hyperlinks (or `T')
32                            Strings in '' which aren't identifiers are ignored
33L<url>                      <url>
34L<Module>                   "Module"
35L<Module/Section>           'Module#Section'
36X<SectionAnchor>            #SectionAnchor# a non-rendered target for '#sec'
37C<monospaced code>          @monospaced code@
38B<emphasis>                 /emphasis/
39=head1                      -- *
40=head2                      -- **
41=head3                      -- ***
42=over, =back                Nothing
43=item *                     * or - at start of paragraph
44=item 1.                    (1) or 1. at start of paragraph
45=item name                  [@name@] at start of paragraph
46
47--| Documentation for the next thing (top level or in declarations)
48{-| Multiline version of above -}
49
50--^ Documentation for the previous thing (top level or in declarations)
51{-^ Multiline version of above -}
52
53
54Documentation Build Process
55===========================
56
57make haddock
58
59This produces the cross-linked html documentation for Pugs in the
60./dist/doc/html directory.  If any of the input .hs files is causes
61haddock to fail then the haddock-broken make target can be used to produce
62documentation for one file at a time.  This is inferior to make haddock
63as the identifier links aren't correctly produced.
64
65Internally, make haddock first filters the .hs files to remove
66problematic constructs.  The haddock program can be confused by some
67GHC extensions and the util/munge_haddock.pl attempts to avoid this.
68
69Note that Haddock only builds documentation for the interface of
70modules, so the documentation for internal methods may not appear
71in the output.  The --# ignore-exports (or {-# ignore-exports}) option
72can appear for the module definition to override this.
73
74Understanding and Correcting Errors
75===================================
76
77If make haddock fails then you can use make haddock-broken to produce
78inferior documentation.  There are a few strategies available to fix
79the file which breaks haddock.  Note that the location of the error
80messages are not always helpful, for example, a "string" pages above
81can cause an error at the first line of code below it.
82
83As haddock ignore plain {-  -} comments, you can just change the "{-|"
84to test whether a particular comment block is causing the problem.
85
86Once the block has been found, it can be split with "-}{-" to binary
87search for the problem.  Turning a paragraph into a verbatim block
88with s/^/> / can also isolate the trouble.  Individual files can
89be run with haddock $filename.
90
91Common problems:
92 - @Larry unescaped @ characters
93 - "double-quoted strings" which are not links to modules 
94 - -- | ControlEnv !Env, misinterpreted commenting out (-- \| instead)
95
96To fix problems you can escape with \, rephrase or use a non-haddock
97comment block.
98
99If the code is the source of the problem then the following #ifdefs
100can be used to remove the code before haddock sees it.  This is done
101in munge_haddock.pl
102
103#ifndef HADDOCK
104#endif HADDOCK
105
106Haddock Vim Syntax File
107=================
108
109Ask bsb on #perl6 if you want to take it for a spin
Note: See TracBrowser for help on using the browser.