[Haskell-cafe] Re: [Haskell] ANN: HLint 1.0
Gwern Branwen
gwern0 at gmail.com
Sat Dec 20 08:59:50 EST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
On Sat, Dec 20, 2008 at 4:55 AM, Neil Mitchell wrote:
> 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.
Hi, Neil. Thanks for the tool; it found some worthwhile changes in my projects.
But a few points:
1) How does one actually use the CLI tool? You didn't say. It *seems*
that one just feeds it a list of random filepaths, so on Mueval, say,
the command would be 'hlint main.hs Mueval/*.hs' (and not, say, 'hlint
mueval.cabal'). But I'm not actually sure.
2) I think I found a parsing bug. One line in Mueval/Interpreter.hs runs:
> fmap (take n exceptionMsg ++) $ render' (n-length exceptionMsg) s
which gives the error:
> Mueval/Interpreter.hs:145:59: Parse failure, Parse error
> No relevant suggestions
Adding spaces between 'n' and 'length', so it reads:
> fmap (take n exceptionMsg ++) $ render' (n - length exceptionMsg) s
lets hlint parse and suggest for it.
- --
gwern
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEAREKAAYFAklM+kwACgkQvpDo5Pfl1oKDhwCfRgQutbvr9QbKvbLJlbhdla2Z
absAniWC+ksXHhfbunsdOsnmG69lppFZ
=X9uv
-----END PGP SIGNATURE-----
More information about the Haskell-Cafe
mailing list