|The Glasgow Haskell Compiler User's Guide, Version 4.06|
|Prev||Chapter 9. Other Haskell utility programs||Next|
`Tags' is a facility for indexing the definitions of programming-language things in a multi-file program, and then using that index to jump around among these definitions.
Rather than scratch your head, saying “Now where did we define `foo'?”, you just do (in Emacs) M-. foo RET, and You're There! Some people go wild over this stuff…
GHC comes with a program hstags, which build Emacs-able TAGS files. The invocation syntax is:
hstags [GHC-options] file [files...]
The best thing is just to feed it your GHC command-line flags. A good Makefile entry might be:
tags: $(RM) TAGS hstags $(GHC_FLAGS) *.lhs
The only flags of its own are: -v to be verbose; -a to APPEND to the TAGS file, rather than write to it.
Shortcomings: (1) Instance declarations don't get into the TAGS file (but the definitions inside them do); as instances aren't named, this is probably just as well. (2) Data-constructor definitions don't get in. Go for the corresponding type constructor instead.
(Actually, GHC also comes with etags [for C], and perltags [for You Know What]. And—I cannot tell a lie—there is Denis Howe's fptags [for Haskell, etc.] in the ghc/CONTRIB section…)