HLint (formerly Dr. Haskell) reads Haskell programs and suggests changes that hopefully make them easier to read. HLint also makes it easy to disable unwanted suggestions, and to add your own custom suggestions.

Running the tool over the darcs source code, we can generate an interactive report with --report, or view the results in the console:

$ hlint darcs-2.1.2

CommandLine.lhs:49:1: Warning, eta reduce
Found:    quotedArg ftable = between (char '"') (char '"') $ quoteContent ftable
Why not:  quotedArg = between (char '"') (char '"') . quoteContent

CommandLine.lhs:94:1: Error, use concatMap
Found:    concat $ map escapeC s
Why not:  concatMap escapeC s

Ssh.hs:155:17: Error, use isPrefixOf
Found:    take 1 path == "~"
Why not:  "~" `isPrefixOf` path

... many other suggestions ...

HLint can only be compiled by GHC 6.10.1 or above (it makes use of view patterns), but does not require any copy of GHC to run. HLint should be able to give hints for any Haskell code, including most GHC extensions. As with any good tool, HLint has been used in the development of itself, and all suggestions have been fixed.

Related work


Tags: haskell popular program