[Haskell] ANN: HLint 1.2

Neil Mitchell ndmitchell at gmail.com
Sun Jan 11 17:05:09 EST 2009


I am pleased to announce HLint version 1.2. HLint is a lint-like tool
for Haskell that detects and suggests improvements for your code.
HLint is compatible with most GHC extensions, and supports a wide
variety of suggestions, and can be extended with additional user

To install: cabal update && cabal install hlint

Web page: http://www-users.cs.york.ac.uk/~ndm/hlint/

Biggest new feature: List recursion suggestions. For example, running
HLint over the GHC compiler now suggests things such as:

Example.hs:3:1: Warning: Use foldr
  seqList [] b = b
  seqList (x : xs) b = x `seq` seqList xs b
Why not:
  seqList xs b = foldr seq b xs

Example.hs:6:1: Warning: Use foldr
  seqIds [] = ()
  seqIds (id : ids) = seqId id `seq` seqIds ids
Why not:
  seqIds ids = foldr (seq . seqId) () ids

Example.hs:13:1: Warning: Use foldl
  rev_app [] xs = xs
  rev_app (y : ys) xs = rev_app ys (y : xs)
Why not:
  rev_app ys xs = foldl (flip (:)) xs ys

HLint will automatically detect if you should have used a map, a foldr
or a foldl and suggest how to change your code. In the GHC, darcs and
Hoogle code bases there are no obvious map-like functions, which is a
good sign :-)

Changes from last time:

* More GHC extensions supported - including record wild cards and
fixes to a number of existing extensions. These changes are thanks to
Niklas and the haskell-src-exts package.

* Many infix operators are now correctly associated with the right priority.

* All hints are now ignored, warnings or errors. Hopefully this should
make it clearer what hints are most important. As part of this, the
format for defining ignore files has changed completely - see the
manual for the new format.

* Lots of new hints have been added - many from users of HLint.

* Many bugs have been fixed.

Can any follow-up discussions please be directed to haskell-cafe at . All
comments, questions, bug reports are welcome!


More information about the Haskell mailing list