Create tag files (ctags and etags) for Haskell code.

LTS Haskell 19.33:
Stackage Nightly 2022-03-17:
Latest on Hackage:

See all snapshots hs-tags appears in

MIT licensed by Ulf Norell, Nils Anders Danielsson, Andrés Sicard-Ramírez, Andreas Abel, Francesco Mazzoli, Paolo G. Giarrusso
Maintained by Andreas Abel
This version can be pinned in stack with:hs-tags-,1900

Module documentation for

There are no documented modules for this package.

Hackage version Hackage CI hs-tags on Stackage Nightly Stackage LTS version Cabal build

hs-tags - Generate tags for Haskell code

Generate tags (ctags) or TAGS (etags) file for a bunch of Haskell files. These files are used by editors (e.g. TAGS by Emacs) to implement jump-to-definition (e.g. M-. in Emacs).

In contrast to hasktags, hs-tags uses the GHC Haskell parser to read the Haskell files and find definition sites.

Example use:

find src -name "*.*hs" | xargs \
  hs-tags --cabal Foo.cabal -i dist/build/autogen/cabal_macros.h -e

Creates Emacs TAGS from Haskell files residing in folder src/ of the project as defined in Foo.cabal, using preprocessor definitions from dist/build/autogen/cabal_macros.h.

Command line reference:

                --help              Show help.
  -c[FILE]      --ctags[=FILE]      Generate ctags (default file=tags)
  -e[FILE]      --etags[=FILE]      Generate etags (default file=TAGS)
  -i FILE       --include=FILE      File to #include
  -I DIRECTORY                      Directory in the include path
                --cabal=CABAL FILE  Cabal configuration to load additional
                                    language options from
                                    (library options are used)

Some related projects:



Version history. Andreas Abel 2022-01-10

  • Fixed #6: build failure with GHC 9.0.2.
  • Tested with GHC 8.0.2 - 9.0.2. Andrés Sicard Ramirez 2021-09-10

  • stack.yaml file for GHC 8.10.7. Andreas Abel 2021-08-22

  • fixed #3: correctly obtain GHC’s libdir

0.1.5 Andreas Abel 2021-03-16

  • initial release
  • tested with GHC 8.0.2 - 9.0.1


  • originally written in Dec 2007 by Ulf Norell to generate ctags via GHC 6.8
  • extended in Feb 2008 by Nils Anders Danielsson to etags
  • since then, used in the Agda development process and updated to new GHC versions