[project @ 2000-06-12 11:41:00 by simonmar]
[ghc-hetmet.git] / ghc / docs / users_guide / utils.sgml
1 <Chapter id="utils">
2 <Title>Other Haskell utility programs
3 </Title>
4
5 <IndexTerm><Primary>utilities, Haskell</Primary></IndexTerm>
6
7 <Para>
8 This section describes other program(s) which we distribute, that help
9 with the Great Haskell Programming Task.
10 </Para>
11
12 <Sect1 id="hstags">
13 <Title>Emacs `TAGS' for Haskell: <Command>hstags</Command>
14 </Title>
15
16 <Para>
17 <IndexTerm><Primary>hstags</Primary></IndexTerm>
18 <IndexTerm><Primary>TAGS for Haskell</Primary></IndexTerm>
19 </Para>
20
21 <Para>
22 `Tags' is a facility for indexing the definitions of
23 programming-language things in a multi-file program, and then using
24 that index to jump around among these definitions.
25 </Para>
26
27 <Para>
28 Rather than scratch your head, saying &ldquo;Now where did we define
29 `foo'?&rdquo;, you just do (in Emacs) <Literal>M-. foo RET</Literal>, and You're There!
30 Some people go wild over this stuff&hellip;
31 </Para>
32
33 <Para>
34 GHC comes with a program <Command>hstags</Command>, which build Emacs-able TAGS files.  The invocation syntax is:
35
36 <Screen>
37 hstags [GHC-options] file [files...]
38 </Screen>
39
40 </Para>
41
42 <Para>
43 The best thing is just to feed it your GHC command-line flags.
44 A good Makefile entry might be:
45
46 <ProgramListing>
47 tags:
48         $(RM) TAGS
49         hstags $(GHC_FLAGS) *.lhs
50 </ProgramListing>
51
52 </Para>
53
54 <Para>
55 The only flags of its own are: <Option>-v</Option> to be verbose; <Option>-a</Option> to
56 <Emphasis>APPEND</Emphasis> to the TAGS file, rather than write to it.
57 </Para>
58
59 <Para>
60 Shortcomings: (1)&nbsp;Instance declarations don't get into the TAGS file
61 (but the definitions inside them do); as instances aren't named, this
62 is probably just as well.  (2)&nbsp;Data-constructor definitions don't get
63 in.  Go for the corresponding type constructor instead.
64 </Para>
65
66 <Para>
67 (Actually, GHC also comes with <Command>etags</Command> &lsqb;for C&rsqb;, and <Command>perltags</Command>
68 &lsqb;for You Know What&rsqb;.  And&mdash;I cannot tell a lie&mdash;there is Denis
69 Howe's <Command>fptags</Command> &lsqb;for Haskell, etc.&rsqb; in the <Filename>ghc/CONTRIB</Filename>
70 section&hellip;)
71 </Para>
72
73 </Sect1>
74
75 <Sect1 id="happy">
76 <Title>&ldquo;Yacc for Haskell&rdquo;: <Command>happy</Command>
77 </Title>
78
79 <Para>
80 <IndexTerm><Primary>happy</Primary></IndexTerm>
81 <IndexTerm><Primary>Yacc for Haskell</Primary></IndexTerm>
82 <IndexTerm><Primary>parser generator for Haskell</Primary></IndexTerm>
83 Andy Gill and Simon Marlow have written a parser-generator for
84 Haskell, called <Command>happy</Command>.<IndexTerm><Primary>happy parser generator</Primary></IndexTerm> <Command>Happy</Command>
85 is to Haskell what <Command>Yacc</Command> is to C.
86 </Para>
87
88 <Para>
89 You can get <Command>happy</Command> from <ulink
90 url="http://www.haskell.org/happy/">the Happy Homepage</ulink>.
91 </Para>
92
93 <Para>
94 <Command>Happy</Command> is at its shining best when compiled by GHC.
95 </Para>
96
97 </Sect1>
98
99 <Sect1 id="pphs">
100 <Title>Pretty-printing Haskell: <Command>pphs</Command>
101 </Title>
102
103 <Para>
104 <IndexTerm><Primary>pphs</Primary></IndexTerm>
105 <IndexTerm><Primary>pretty-printing Haskell code</Primary></IndexTerm>
106 </Para>
107
108 <Para>
109 Andrew Preece has written
110 <Command>pphs</Command>,<IndexTerm><Primary>pphs</Primary></IndexTerm><IndexTerm><Primary>pretty-printing Haskell</Primary></IndexTerm>
111 a utility to pretty-print Haskell code in LaTeX documents.
112 Keywords in bolds, variables in italics&mdash;that sort of thing.  It is
113 good at lining up program clauses and equals signs, things that are
114 very tiresome to do by hand.
115 </Para>
116
117 <Para>
118 The code is distributed with GHC in <Filename>ghc/CONTRIB/pphs</Filename>.
119 </Para>
120
121 </Sect1>
122
123 </Chapter>
124
125 <!-- Emacs stuff:
126      ;;; Local Variables: ***
127      ;;; mode: sgml ***
128      ;;; sgml-parent-document: ("users_guide.sgml" "book" "chapter") ***
129      ;;; End: ***
130  -->