Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
Neil Mitchell - HLint
[go: Go Back, main page]

HLint

HLint is a tool to detect common mistakes in Haskell programs. The tool was formerly called Dr Haskell.

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

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

darcs-2.1.2\src\CommandLine.lhs:49:1: Warning: 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: Error: Use concatMap
Found:
  concat $ map escapeC s
Why not:
  concatMap escapeC s

darcs-2.1.2\src\CommandLine.lhs:103:1: Warning: Use fewer brackets
Found:
  ftable ++ (map (\ (c, x) -> (toUpper c, urlEncode x)) ftable)
Why not:
  ftable ++ map (\ (c, x) -> (toUpper c, urlEncode x)) ftable

darcs-2.1.2\src\Darcs\Patch\ReadMonads.hs:61:29: Warning: Use const
Found:
  \ _ -> Nothing
Why not:
  const Nothing

darcs-2.1.2\src\Darcs\RemoteApply.lhs:62:1: Warning: Use a list comprehension
Found:
  if Debug `elem` opts then ["--debug"] else []
Why not:
  ["--debug" | Debug `elem` opts]

darcs-2.1.2\src\Ssh.hs:155:17: Error: Use isPrefixOf
Found:
  take 1 path == "~"
Why not:
  "~" `isPrefixOf` path

darcs-2.1.2\src\Darcs\Patch\Test.lhs:306:1: Error: Use a more efficient monadic variant
Found:
  mapM (delete_line (fn2fp f) line) old
Why not:
  mapM_ (delete_line (fn2fp f) line) old

darcs-2.1.2\src\Darcs\Repository\Prefs.lhs:231:5: Warning: Use foldl
Found:
  abf fi (r : rs) = abf (\ f -> fi f && isNothing (matchRegex r f)) rs
  abf fi [] = fi
Why not:
  abf fi rs = foldl (\ fi r f -> fi f && isNothing (matchRegex r f)) fi rs

... 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.

Acknowledgements

This program has only been made possible by the presence of the haskell-src-exts package, and many useful improvements have been made by Niklas Broberg in response to feature requests.

Downloads

Tags: haskell popular program