[Haskell] ANN: HLint 1.0

Neil Mitchell ndmitchell at gmail.com
Sat Dec 20 04:55:30 EST 2008


Hi,

I am pleased to announce HLint, a tool for making suggestions to
improve your Haskell code. Previously this tool was called Dr Haskell
and depended on a working installation of Yhc - both of those have now
changed. HLint requires GHC 6.10*, and to install simply type:

cabal update && cabal install hlint

If you haven't yet installed the cabal command, instructions are here:
http://ghcmutterings.wordpress.com/2008/11/10/bootstrapping-cabal-install/

As an example of what HLint does, running "hlint darcs-2.1.2" over the
latest stable release of darcs gives 385 suggestions, including:

darcs-2.1.2\src\CommandLine.lhs:46:1: Use a string literal
Found:
  [' ', '\t', '"', '%']
Why not:
  " \t\"%"

darcs-2.1.2\src\CommandLine.lhs:49:1: Eta reduce
Found:
  quotedArg ftable
    = between (char '"') (char '"') $ quoteContent ftable
Why not:
  quotedArg = between (char '"') (char '"') . quoteContent

darcs-2.1.2\src\CommandLine.lhs:94:1: Use concatMap
Found:
  concat $ map escapeC s
Why not:
  concatMap escapeC s

To see all the hints in a nice interactive document visit
http://www-users.cs.york.ac.uk/~ndm/hlint/hlint-report.htm
(recommended if you are thinking of trying out hlint)

All necessary links, including a manual, hackage links, bug tracker
and source code can be found from the tool website:
http://www-users.cs.york.ac.uk/~ndm/hlint/

Acknowledgements: Niklas Broberg and the haskell-src-exts package have
both been very helpful. The darcs users mailing list gave many good
suggestions which I've incorportated.

Please direct any follow up conversations to haskell-cafe@

Thanks

Neil

* Why GHC 6.10? View patterns.


More information about the Haskell mailing list