Though there are diverse tools for Haskell development many are not widely advertised; here I collect those I use.
Development Tools
GHC
GHC is the Haskell compiler that I use. It has various profiling options.
I use :ctags
in GHCi to generate tagfiles for Vim.
You can get a stack trace on your Haskell programs by passing -xc
as
an rts option, viz.
./my-binary +RTS -xc
Note that my-binary
must be a compiled for profiling (see below)
cabal-install
cabal-install is the build tool I use.
Generate a profiling build with
cabal build -p --enable-profiling
and generate a static executable with
cabal --enable-executable-static
You can verify that none of your dependency bounds are out-of-date with
cabal outdated
cabal can be used as a script interpreter (see here), and it supports project dependencies on a source control repository (example).
To build with coverage:
cabal build --enable-coverage
Try running
cabal test --enable-coverage
This will generate a coverage report, pointing out which functions and conditions are not vetted by your test suite.
hp2pretty
This converts a heap profile (.hp
) to a graph written as an SVG file. The
graphs are legible, unlike those written by hp2ps
.
pointfree
pointfree is a command-line tool that can give hints on how to write various things in pointfree style.
doctest
I use doctest
occasionally. It ensures documentation examples are correct
and up-to-date.
hlint
hlint is a linter for Haskell. It supports custom hints via a configuration file.
hoogle
Hoogle is a search engine that can work on type signatures. The web frontend is here.
There is a command-line version available from Hackage
stylish-haskell
stylish-haskell is a code formatter for Haskell.
apply-refact
I have apply-refact installed because hlint uses it to automatically refactor.
cabal-plan
weeder
threadscope
ThreadScope is a tool to debug performance of parallel programs.
More on the Haskell wiki.
haddock
Haddock is the documentation generator for Haskell. It is distributed with GHC. Run it with
cabal haddock
Preprocessors
c2hs
This is a tool to safely generate Haskell bindings to C code. It can read
C header files and generate foreign import …
declarations.
Example here.
See Edward Yang's blog posts and the wiki for more detail.
Happy
Happy is a parser generator for Haskell; it integrates with Alex. In my experience it is far better than using a parser combinator library for parsing programming languages; it is also more performant.
Pay special attention to parametric productions, which provide some of the ease of parser combinators.
Alex
Alex is a lexer generator for Haskell. It generates faster lexers than parser combinator libraries.
Vim Plugins
c2hs-vim
Syntax highlighting extensions for vim that makes .chs
files look sensible.
ghci-syntax
Syntax highlighting and detection of .ghci
files.
cabal-project-vim
Alex Syntax Highlighting
Happy Syntax Highlighting
hs-conceal
Display forall
as ∀
(for instance) when not editing that particular line.
syntastic
Integrates with hlint.
vim-hoogle
Hoogle integration for Vim.
hspec-vim
Syntax highlighting for hspec.
pointfree-vim
A Vim plugin for pointfree.