Source code suggestions https://github.com/ndmitchell/hlint#readme

Version on this page:1.9.21
LTS Haskell 8.12:1.9.41
Stackage Nightly 2017-04-24:1.9.41
Latest on Hackage:2.0.5
BSD3 licensed and maintained by Neil Mitchell

Module documentation for 1.9.21

HLint Hackage version Stackage version Linux Build Status Windows Build Status

HLint is a tool for suggesting possible improvements to Haskell code. These suggestions include ideas such as using alternative functions, simplifying code and spotting redundancies. You can try HLint online at lpaste.net - suggestions are shown at the bottom. This document is structured as follows:


This program has only been made possible by the presence of the haskell-src-exts package, and many improvements have been made by Niklas Broberg in response to feature requests. Additionally, many people have provided help and patches, including Lennart Augustsson, Malcolm Wallace, Henk-Jan van Tuyl, Gwern Branwen, Alex Ott, Andy Stewart, Roman Leshchinskiy, Johannes Lippmann, Iustin Pop, Steve Purcell and others.

Bugs and limitations

Bugs can be reported on the bug tracker. There are some issues that I do not intend to fix:

  • HLint operates on each module at a time in isolation, as a result HLint does not know about types or which names are in scope.
  • The presence of seq may cause some hints (i.e. eta-reduction) to change the semantics of a program.
  • Some transformed programs may require additional type signatures, particularly if the transformations trigger the monomorphism restriction or involve rank-2 types.
  • The RebindableSyntax extension can cause HLint to suggest incorrect changes.
  • HLint turns on many language extensions so it can parse more documents, occasionally some break otherwise legal syntax - e.g. {-#INLINE foo#-} doesn't work with MagicHash. These extensions can be disabled with -XNoMagicHash.

Installing and running HLint

Installation follows the standard pattern of any Haskell library or program: type cabal update to update your local hackage database, then cabal install hlint to install HLint.

Once HLint is installed, run hlint source where source is either a Haskell file, or a directory containing Haskell files. A directory will be searched recursively for any files ending with .hs or .lhs. For example, running HLint over darcs would give:

$ hlint darcs-2.1.2

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

darcs-2.1.2\src\CommandLine.lhs:103:1: Suggestion: Use fewer brackets
  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\Test.lhs:306:1: Warning: Use a more efficient monadic variant
  mapM (delete_line (fn2fp f) line) old
Why not:
  mapM_ (delete_line (fn2fp f) line) old

... lots more hints ...

Each hint says which file/line the hint relates to, how serious an issue it is, a description of the hint, what it found, and what you might want to replace it with. In the case of the first hint, it has suggested that instead of applying concat and map separately, it would be better to use the combination function concatMap.

The first hint is marked as an warning, because using concatMap in preference to the two separate functions is always desirable. In contrast, the removal of brackets is probably a good idea, but not always. Reasons that a hint might be a suggestion include requiring an additional import, something not everyone agrees on, and functions only available in more recent versions of the base library.

Bug reports: The suggested replacement should be equivalent - please report all incorrect suggestions not mentioned as known limitations.

Automatically Applying Hints

By supplying the --refactor flag hlint can automatically apply most suggestions. Instead of a list of hints, hlint will instead output the refactored file on stdout. In order to do this, it is necessary to have the refactor executable on you path. refactor is provided by the apply-refact package, it uses the GHC API in order to transform source files given a list of refactorings to apply. Hlint directly calls the executable to apply the suggestions.

Additional configuration can be passed to refactor with the --refactor-options flag. Some useful flags include -i which replaces the original file and -s which asks for confirmation before performing a hint.

An alternative location for refactor can be specified with the --with-refactor flag.

Simple bindings for vim, emacs and atom are provided.

There are no plans to support the duplication nor the renaming hints.


HLint can generate a lot of information, making it difficult to search for particular types of errors. The --report flag will cause HLint to generate a report file in HTML, which can be viewed interactively. Reports are recommended when there are more than a handful of hints.

Language Extensions

HLint enables most Haskell extensions, disabling only those which steal too much syntax (currently Arrows, TransformListComp, XmlSyntax and RegularPatterns). Individual extensions can be enabled or disabled with, for instance, -XArrows, or -XNoMagicHash. The flag -XHaskell2010 selects Haskell 2010 compatibility.

Emacs Integration

Emacs integration has been provided by Alex Ott. The integration is similar to compilation-mode, allowing navigation between errors. The script is at hs-lint.el, and a copy is installed locally in the data directory. To use, add the following code to the Emacs init file:

(require 'hs-lint)
(defun my-haskell-mode-hook ()
   (local-set-key "\C-cl" 'hs-lint))
(add-hook 'haskell-mode-hook 'my-haskell-mode-hook)

GHCi Integration

GHCi integration has been provided by Gwern Branwen. The integration allows running :hlint from the GHCi prompt. The script is at hlint.ghci, and a copy is installed locally in the data directory. To use, add the contents to your GHCi startup file.

Parallel Operation

To run HLint on 4 processors append the flags -j4. HLint will usually perform fastest if n is equal to the number of physical processors, which can be done with -j alone.

If your version of GHC does not support the GHC threaded runtime then install with the command: cabal install --flags="-threaded"

C preprocessor support

HLint runs the cpphs C preprocessor over all input files, by default using the current directory as the include path with no defined macros. These settings can be modified using the flags --cpp-include and --cpp-define. To disable the C preprocessor use the flag -XNoCPP. There are a number of limitations to the C preprocessor support:

  • HLint will only check one branch of an #if, based on which macros have been defined.
  • Any missing #include files will produce a warning on the console, but no information in the reports.


Why are hints not applied recursively?


foo xs = concat (map op xs)

This will suggest eta reduction to concat . map op, and then after making that change and running HLint again, will suggest use of concatMap. Many people wonder why HLint doesn't directly suggest concatMap op. There are a number of reasons:

  • HLint aims to both improve code, and to teach the author better style. Doing modifications individually helps this process.
  • Sometimes the steps are reasonably complex, by automatically composing them the user may become confused.
  • Sometimes HLint gets transformations wrong. If suggestions are applied recursively, one error will cascade.
  • Some people only make use of some of the suggestions. In the above example using concatMap is a good idea, but sometimes eta reduction isn't. By suggesting them separately, people can pick and choose.
  • Sometimes a transformed expression will be large, and a further hint will apply to some small part of the result, which appears confusing.
  • Consider f $ (a b). There are two valid hints, either remove the $ or remove the brackets, but only one can be applied.

Why doesn't the compiler automatically apply the optimisations?

HLint doesn't suggest optimisations, it suggests code improvements - the intention is to make the code simpler, rather than making the code perform faster. The GHC compiler automatically applies many of the rules suggested by HLint, so HLint suggestions will rarely improve performance.

Why doesn't HLint know the fixity for my custom !@%$ operator?

HLint knows the fixities for all the operators in the base library, but no others. HLint works on a single file at a time, and does not resolve imports, so cannot see fixity declarations from imported modules. You can tell HLint about fixities by putting them in a hint file, or passing them on the command line. For example, pass --with=infixr 5 !@%$, or put all the fixity declarations in a file and pass --hint=fixities.hs. You can also use --find to automatically produce a list of fixity declarations in a file.

Which hints are used?

HLint uses the hlint.yaml file it ships with by default (containing things like the concatMap hint above), along with with the first .hlint.yaml file it finds in the current directory or any parent thereof. To include other hints, pass --hint=filename.yaml. If you pass any --with hint you will need to explicitly add any --hint flags required.

Why do I sometimes get a "Note" with my hint?

Most hints are perfect substitutions, and these are displayed without any notes. However, some hints change the semantics of your program - typically in irrelevant ways - but HLint shows a warning note. HLint does not warn when assuming typeclass laws (such as == being symmetric). Some notes you may see include:

  • Increases laziness - for example foldl (&&) True suggests and including this note. The new code will work on infinite lists, while the old code would not. Increasing laziness is usually a good idea.
  • Decreases laziness - for example (fst a, snd a) suggests a including this note. On evaluation the new code will raise an error if a is an error, while the old code would produce a pair containing two error values. Only a small number of hints decrease laziness, and anyone relying on the laziness of the original code would be advised to include a comment.
  • Removes error - for example foldr1 (&&) suggests and including the note Removes error on []. The new code will produce True on the empty list, while the old code would raise an error. Unless you are relying on the exception thrown by the empty list, this hint is safe - and if you do rely on the exception, you would be advised to add a comment.

What is the difference between error/warning/suggestion?

Every hint has a severity level:

  • Error - by default only used for parse errors.
  • Warning - for example concat (map f x) suggests concatMap f x as a "warning" severity hint. From a style point of view, you should always replace a combination of concat and map with concatMap.
  • Suggestion - for example x !! 0 suggests head x as a "suggestion" severity hint. Typically head is a simpler way of expressing the first element of a list, especially if you are treating the list inductively. However, in the expression f (x !! 4) (x !! 0) (x !! 7), replacing the middle argument with head makes it harder to follow the pattern, and is probably a bad idea. Suggestion hints are often worthwhile, but should not be applied blindly.

The difference between warning and suggestion is one of personal taste, typically my personal taste. If you already have a well developed sense of Haskell style, you should ignore the difference. If you are a beginner Haskell programmer you may wish to focus on warning hints before suggestion hints.

Customizing the hints

To customize the hints given by HLint, create a file .hlint.yaml in the root of your project. For a suitable default run:

hlint --default > .hlint.yaml

This default configuration contains lots of examples, including:

  • Adding command line arguments to all runs, e.g. --color or -XNoMagicHash.
  • Ignoring certain hints, perhaps within certain modules/functions.
  • Restricting use of GHC flags/extensions/functions, e.g. banning Arrows and unsafePerformIO.
  • Adding additional project-specific hints.

You can see the output of --default here.

Ignoring hints

Some of the hints are subjective, and some users believe they should be ignored. Some hints are applicable usually, but occasionally don't always make sense. The ignoring mechanism provides features for suppressing certain hints. Ignore directives can either be written as pragmas in the file being analysed, or in the hint files. Examples of pragmas are:

  • {-# ANN module "HLint: ignore Eta reduce" #-} - ignore all eta reduction suggestions in this module (use module literally, not the name of the module).
  • {-# ANN myFunction "HLint: ignore" #-} - don't give any hints in the function myFunction.
  • {-# ANN myFunction "HLint: error" #-} - any hint in the function myFunction is an error.
  • {-# ANN module "HLint: error Use concatMap" #-} - the hint to use concatMap is an error (you may also use warn or suggest in place of error for other severity levels).

Ignore directives can also be written in the hint files:

  • - ignore: {name: Eta reduce} - suppress all eta reduction suggestions.
  • - ignore: {name: Eta reduce, within: [MyModule1, MyModule2]} - suppress eta reduction hints in the MyModule1 and MyModule2 modules.
  • - ignore: {within: MyModule.myFunction} - don't give any hints in the function MyModule.myFunction.
  • - error: {within: MyModule.myFunction} - any hint in the function MyModule.myFunction is an error.
  • - error: {name: Use concatMap} - the hint to use concatMap is an error (you may also use warn or suggest in place of error for other severity levels).

These directives are applied in the order they are given, with later hints overriding earlier ones.

Adding hints

The hint suggesting concatMap can be defined as:

- warn: {lhs: concat (map f x), rhs: concatMap f x}

This line can be read as replace concat (map f x) with concatMap f x. All single-letter variables are treated as substitution parameters. For examples of more complex hints see the supplied hlint.yaml file in the data directory. This hint will automatically match concat . map f and concat $ map f x, so there is no need to give eta-reduced variants of the hints. Hints may tagged with error, warn or suggest to denote how severe they are by default. In addition, hint is a synonym for suggest. If you come up with interesting hints, please submit them for inclusion.

You can search for possible hints to add from a source file with the --find flag, for example:

$ hlint --find=src/Utils.hs
-- hints found in src/Util.hs
- warn: {lhs: "null (intersect a b)", rhs: "disjoint a b"}
- warn: {lhs: "dropWhile isSpace", rhs: "trimStart"}
- fixity: "infixr 5 !:"

These hints are suitable for inclusion in a custom hint file. You can also include Haskell fixity declarations in a hint file, and these will also be extracted. If you pass only --find flags then the hints will be written out, if you also pass files/folders to check, then the found hints will be automatically used when checking.

More Advanced Hints

Hints can specify more advanced aspects, with names and side conditions. To see examples and descriptions of these features look at the default hint file and the hint interpretation module comments.

Hacking HLint

Contributions to HLint are most welcome, following my standard contribution guidelines. You can run the tests either from within a ghci session by typing :test or by running the standalone binary's tests via stack exec hlint test.

New tests for individual hints can be added directly to source and hint files by adding annotations bracketed in <TEST></TEST> code comment blocks. As some examples:

    Tests to check the zipFrom hint works

zip [1..length x] x -- zipFrom 1 x
zip [1..length y] x
zip [1..length x] x -- ??? @Warning

The general syntax is lhs -- rhs with lhs being the expression you expect to be rewritten as rhs. The absence of rhs means you expect no hints to fire. In addition ??? lets you assert a warning without a particular suggestion, while @ tags require a specific severity -- both these features are used less commonly.


Changelog for HLint

If the datadir is missing use data/ relative to the executable
Fix test mode to obey --datadir
--default adds ignores for any warnings it finds
#312, suggest removing the DeriveAnyClass extension
Suggest removing the DeriveLift extension
Remove redundant parts from list comprehensions, e.g. [a | True]
#326, fix up the bounds on the eta-reduce hint
#323, try and avoid malformatted JSON
#324, use `backticks` in notes
#324, remove double escaping in note for --json
#322, fix the YAML syntax in default.yaml
#320, still read ./HLint.hs if it exists
#319, add a hint \x -> f <$> g x ==> fmap f . g
Don't say how many hints were ignored
Add a --default flag
#314, allow arguments in YAML configuration files
Add maybe False (== x) ==> (== Just x) hint, plus for /=
Remove the ability to pass the file on stdin using - as the file
Remove encoding from ParseFlags
Remove the --encoding/--utf8 options, always use UTF8
#311, suggest writeFile instead of withFile/hPutStr
#288, add configurable restrictions
Suggest using an export list on modules
Look for nearby .hlint.yaml files to supply configuration
Support YAML configuration files
#308, don't suggest newtype for unboxed types
Remove the import "hint" feature for hint inclusion
Builtin hints do not need to be imported, can only be ignored
Delete HLint2 API
#290, add hints suggesting traverse/traverse_
#303, detect unused OverloadedStrings extension
#302, detect unused TupleSections extension
#299, warn in some cases when NumDecimals extension is unused
#300, warn when LambdaCase extension is unused
#301, when suggesting newtype remove strictness annotations
#297, better testing that there isn't a performance regression
#167, add -j flag for number of threads
#292, add fst/snd . unzip ==> map fst/snd
Don't suggest module export trick, breaks Haddock
#293, fix the JSON format of the output
#287, don't incorrectly suggest newtype
#279, suggest newtype instead of data
#262, add rules to detect redundant castPtr calls
Detect unused TypeApplications extension
#277, don't enable TypeApplications extension by default
Allow haskell-src-exts-1.19
#276, remove multiple redundant parens in one go
#160, add a --only CLI option
#237, fix incorrect quasi quotes extension warning
#257, better bang pattern hints
#255, don't suggest id @Int ==> @Int
#252, avoid clashes with GHCJS in the interim
Require haskell-src-exts-1.18
#249, suggest avoiding elem on singletons
#245, fix parse error reports
#243, update hlint.ghci to work with modern GHC
Require extra-1.4.9
#154, fix some incorrect line numbers in literate Haskell
#161, fix literate Haskell and CPP
#240, remove type-incorrect "on" hint
#234, warn about join seq
#232, suggest <|> instead of mplus in a few cases
#53, require cpphs-1.20.1, has important fixes
#224, treat select $ specially, as per esqueleto conventions
#231, don't modify qualification on substitutions
#229, add void/mapM_/forM_ hints
#222, don't suggest removing ~ if the Strict extension is on
#220, fix incorrect hints of foldr/foldl on a tuple accumulator
#219, add warnings about foldable methods on tuple
Put warnings before suggestions in the HTML report
#215, spot newtype deriving inside classes
#203, avoid recompiling everything twice
#213, don't suggest removing bang patterns on let
Rename HintStructure to HintPattern
#208, add an hlint function to the HLint3 API
#1, warn about unused DefaultSignatures extension
#137, add -XHaskell2010 and fix -XHaskell98
Allow checking even if a function has different arities
#193, don't warn on a -> (b -> c), it's sometimes sensible
#182, make parse errors severity Error
#181, warn on otherwise in a pattern variable
#163, eta reduce fun x = f $ x
#132, don't ever suggest liftM
#99, downgrade built in hints, Error => Warning => Suggestion
#99, add a Suggestion level severity
#207, make sure you close file handles
#205, add hint compare x y == EQ and /=
#204, add hint concatMap id ==> concat
#202, include refactorings is --json output
#200, fix all lint warnings
#143, expose argsSettings
#192, fix stdin output and --refactor
#188, improve spotting redundant brackets around patterns
#138, reenable redundant where hint
#184, require haskell-src-exts-1.17
#183, allow test_ as a prefix
Don't suggest redundant lambda on view patterns
Add --no-exit-code flag
#174, don't suggest string literals
#175, disable 'rec' stealing extensions by default
#170, add hints for eta-reduced operators
#149, integrate a --refactor flag
#147, fix the -fglasgow-exts hint
#140, better name for moving brackets to eliminate $
Extra hints for <$>
Remove a redundant fmap hint
#131, add =<< rules in addition to >>=
#130, ignore a BOM if it exists
#128, don't find files starting with . when searching directories
Suggest concat even if the [] is written ""
#122, fix the zipWith/repeat hint
#119, don't remove RecursiveDo if they use the rec statement
Add a suggestion concatMap/map ==> concatMap
More GHC 7.10 warnings and build support
#116, support hscolour-1.21
#108, make "hlint ." work again
#106, avoid warnings with GHC 7.10
#105, build with GHC 7.10
#649, don't suggest const for values using RecordWildCards
#97, remove the encoding bits of the API
#98, add an HLint3 prototype API
#93, make the --quickcheck tests work on GHC 7.8
Add --tempdir flag to the test mode
#96, fix the --utf8 flag
Make Encoding an alias for TextEncoding
Default to UTF8 encoding
#95, don't suggest camel case for names containing digits
Add a dependency on the extra package
#92, use a new way for determining the color default
Add a dependency on ansi-terminal
Spot unsafePerformIO without NOINLINE
#89, fix compiling the executable with --flag=-gpl
#82, don't crash on XmlHybrid modules
#88, allow avoiding HsColour, as it is GPL licensed
#87, don't push if down, since it can be type incorrect
#86, don't use color unless $TERM claims to support it
#85, fix the free variable matching check for lambda
#84, suggest fmap for Either
Make --json put each hint on a different line
Support -X for extensions to the hse mode
Remove support for GHC 7.2
Upgrade to haskell-src-exts-1.16
#81, fixes for GHC 7.9
#78, add hints for list patterns
#72, make --color the default on Linux
#73, fix multithreading and exceptions
#68, add --no-summary
#65, add flip (>>=) ==> (=<<) and the reverse
#61, add --json flag
Remove not (isControl x) ==> isPrint (not true for '\173')
#57, warn on invalid pragmas
Make the API pass and require comments
#59, make sure qualified operators match properly
Rename notTypeSafe annotation to noTypeCheck
Remove an invalid rule suggesting tanh
#13, add a --quickcheck flag to test the hints
Add --typecheck flag to test mode to type check the hints
Remove incorrect for intercalate to unlines
#37, remove incorrect hint for isAlphaNum
#45, add mapMaybe id ==> catMaybes
#42, add some repeat hints
#40, allow haskell-src-exts-1.15
Don't detect redundant Generics extension
#33, add --cpp-file to preinclude a file
#34, add back --quiet flag
#639, don't suggest evaluate, because not all Monad's are IO
#31, delete the elem/notElem hints
#30, remove weird "free module" matching
#15, add prototype grep mode
Change to make test a separate mode
#12, more list based suggestions
#637, turn off QuasiQuotes by default
#27, fix up directory file searching
Move the API to Language.Haskell.HLint2
#638, ensure $! doesn't break strictness with strict fields
#24, don't remove DeriveFunctor even when only on a newtype
#22, turn off UnboxedTuples by default
#21, strip /* C style */ comments
#635 and #18, require cpphs-1.18.1
Switch to CmdArgs for command line parsing
Remove -x as a synonym for --cross
#6, add a preview of an API
#331, improve parse error locations for literate Haskell
Remove support for GHC 6.12 and below
#317, tone down the void hint
#16, match not . not (and reverse . reverse etc)
Suggest <$> instead of fmap f $ ...
Tweak some priorities, make >=> a warn and void an error
#3, make top of the file ANN pragmas work
#10, add a suggestion to use unlines
#11, add a few hints about characters
#8, add CHANGES.txt to the Cabal package
#627, fix the UnboxedTuples extension warning
Fix a bug when suggesting const
Fix some corner cases when suggesting foldr etc.
#517, don't introduce new free variables in a replacement
#2, Generic is not newtype derivable
Upgrade to haskell-src-exts-1.14
Eliminate upper bounds on all dependencies
#617, fix up notIn to take account of Template Haskell variables
#573, suggest removing various deriving language extensions
Remove ^^ ==> ** hint
Remove a duplicate sqrt hint
Ensure that --test failures throws an error
Fix up the copyright year in --help
Brackets at the root of annotations are fine
Reduce a few more lambda expressions
#613, compatibility with base-4.7
Remove incorrect isPrefixOf hints
#586, add span/break/takeWhile/dropWhile hints
#588, add sort/reverse hints
#601, add replicate/map/repeat hints
Add a hint about reverse/reverse
Add side as an alias for _
Add hint as an alias for error
#600, hints for unnecessary lazy annotations
#598, warn on unnecessary bang patterns
Change some hint error/warning levels
Allow cpphs-1.16
#586, add a rule for takeWhile/dropWhile ==> span
#522, add hints for the state monad
#499, fix up the test suite
Fix the side conditions for the `isPrefixOf` hint
Add hints about take/drop on non positive numbers
Add isNat/isPos/isNeg/isNegPos as notes
Make the notes a structured type
Add --proof feature
Retire the Prelude.catch hint
Additional boolean equality hints
#585, lots of additional list based hints
#582, don't suggest renaming with trailingHashes#
#578, treat _ bindings differently in lambdas
#575, allow cpphs-1.15
Make --with imply no default Hint files
#567, avoid duplicate hints around (.) hints
Switch license from GPL to BSD3
Lots more hints on laziness, foldable and a few others
Use mapM_ etc in more situations, when using explicit >>=
Add notes about how to deal with imported fixites
Add a --with flag for passing settings on the command line
#563, make sure TypeSig hints get the right function name
Update the copyright year to 2012
#564, allow brackets and type signatures on annotations
Add a note that about using !! if the index is negative
Avoid incomplete patterns when reading ANN pragmas
#555, top-level expressions require TemplateHaskell
Add elemIndex/elemIndices hints
Allow cpphs-1.14
#551, allow case_ as a name with an underscore
Allow hscolor-1.20.*
#574, add a hint to for mapM/zip ==> zipWithM
Fix a bug, >=> hint was missing check about removal of free var
Allow haskell-src-exts-1.13.*
Allow haskell-src-exts-1.12.*
Don't suggest redundant brackets when turning ++ into :
Add hints suggesting >=> and <=<
Update the copyright year in the Cabal file
Allow transformers-0.3.*
#531, Make hlint.ghci well formed again
Add hints for redundant seq/evaluate using isWHNF
#526, don't hint for return $! (x :: Int)
Add hint for $! where the RHS is not a variable
#508, add lots of hints from the base library
#317, add hints for a >> return () to void
Add a fromMaybe/fmap ==> maybe hint
#304, don't backet tuple sections
Add foldl (++) [] ==> concat
#512, detect unnecessary case construct
When finding hints, don't abort on a parse error
#507, add exitSuccess hint
#505, suggest record patterns
#500, make sure eta reduction has position information
#498, eta reduce even if there is a where block
#497, don't produce an incorrect lambda when suggesting flip
#438, use Foo.Bar to mean Foo/Bar.hs
Add a --path command line option to say where files live
#441, avoid bad matches due to automatically eta reducing rules
#489, import Foo as Foo is redundant
#481, suggest liftM instead of fmap when using the Monad laws
#479, allow - as the file to specify using stdin
#478, allow cpphs-1.13.1
Never suggest view patterns (they aren't sufficiently better)
Don't suggest use of Data.Ord.comparing, using `on` is better
Only suggest elem/notElem on 3 or more items
Add --cpp-ansi to turn on ANSI compat in cpphs
#455, GHC 7.2 compatibility
Add lots of hints from Lennart Augustsson
#302, add a backup fixity analysis, if the HSE one fails
Fix x /= y || x /= z ==> x `notElem` [y,z], should be &&
Allow cpphs-1.12
#440, suggest removing redundant brackets under do
#439, don't add redundant brackets under do
Upgrade to hscolour-1.19
#436, add a hint about mapMaybe/map
Upgrade to haskell-src-exts-1.11.1
Add a --cross flag, to detect hints between multiple modules
#428, don't suggest using String in an instance head
#384, suggest collapsing multiple imports/exports
#374, don't suggest the removal of necessary brackets
#337, suggest Control.Exception.catch instead of Prelude.catch
#412, add hints based on Control.Exception
#378, suggest removing fromInteger/fromIntegral on literals
#369, add notes to a few hints about possible pitfalls
#409, fix a few cases where definitions suggested themselves
#410, Support test* as ignored items in settings files
#414, add isLit* pattern, and hint about ^^ ==> **
#420, make the suggestion to use let a warning
#408, rework the when/unless hints, don't suggest on itself
Add duplicate detector, for copy/pasted code
#285, don't show duplicate filepath separators
If the user enters directories containing no files then say
Make suggesting curry/uncurry a warning instead of an error
Relax the transformers dependency, works with 0.0.* and 0.1.*
Export suggestionSeverity/Severity from the API
Allow hint imports with "hlint", as well as the existing "hint"
Update the copyright year to 2011
#400, support more encoding strings, give useful errors
#401, rename the report template to report_template.html
Replace filter f x /= [] with any f x, and 2 more similar
#308, allow haskell-src-exts-1.10.1, which parses Unicode better
import qualified Char ==> import qualified Data.Char as Char
#393, fix suggestion for import IO, requires more than System.IO
#376, note that RecordWildCards implies DisambiguateRecordFields
Allow uniplate-1.6
Switch from mtl to transformers
#373, require haskell-src-exts-1.9.6
Add a type signature for GHC 7
Suggest [x | x <- xs] ==> xs, if x is a variable
#371, foo (\x -> y :: Int -> Int) is not a redundant bracket
Add a hint to use just equality rather than isJust/fromJust
Massive speed up for files with many naming hints
#361, keep module names when suggesting infix
Add support for wildcard matching on module names
#357, don't camel case suggest on FOO_A
#370, fix building with GHC 6.10.4
#313, upgrade to haskell-src-exts-1.9.4
Workaround for #358, disable empty where hints
#355, make "--ignore=Parse error" work
Add --cpp-simple to run a simple CPP to strip lines begining #
Add bracketing information if the parent is a case
Suggest intercalate
Make --test --hint=file typecheck a file for valid hints
#347, Suggest use of otherwise, instead of True, in pattern guards
Add hints about redundant where statements
Suggest removal of redundant guards
Make hints about guards work on patterns/infix matches/case alts
Make finding guards look a child functions
Correctly collapse functions and lambdas using the same patterns
Suggest promoting patterns bound to lambdas to functions
Allow collapsing lambdas sharing pattern variables correctly
#344, only give one warning for multiple collapsable lambdas
#300, substantially improve module name resolution with imports
BREAKING: imports in hint files require import "hint" HintFile
#335, redundant id should only generate one warning
Add a hint for using map (f &&& g)
#328, for foo'bar suggest the naming fooBar
#323, detect redundant brackets in field declarations
#321, force the whole file before displaying a parse error
Make --find more robust, fixes a potential parse error
Upgrade to hscolour-1.17
#318, match rules by expanding out (.)
#319, don't remove lambdas on the right of infix operators
Add a --quiet flag, to supress stdout (mainly for API users)
Add support for HLint.Builtin.All
Fix crash on (\x -> x)
Make the library correctly honour the data directory
Improve the manual, mainly language changes and hyperlinking
Fix a bug in ListRec, could have _recursive_ in the result
#315, spot list rec hints through $ and let
Add hints based on (f $) ==> f, and change in ListRec hints
Changes to the lambda suggestions, now gives a few more hints
Don't suggest importing modules in old-locale/old-time
Make the API return the suggestions, rather than just the count
#278, add -XNoCpp to disable the C preprocessor
#279, add -XExt/-XNoExt to choose extensions
Remove some redundant brackets in type replacements
#286, remove redundant brackets in match
Additional bracket removal, application under sections
#299, rework hints to use flip (suggest infix in some cases)
Add some fromMaybe hints
Fix bug where hints didn't always get names
#306, make --find use the hints if there are files specified
Upgrade to haskell-src-exts-1.9
#303, allow fixities to be specified in hint files
#287, warn about Haskell 98 imports
#297, add a hint to use mplus
#288, detect redundant brackets under a lambda
#302, remove error about ambiguous fixities
#281, enhance the redundant monad return warnings
#293, eliminate _noParen_ from the result
#284, eliminate ViewPatterns from FindHints, hits compiler bug
#283, don't suggest removal of RecordWildCards
Add some hints about concat and (++)
#273, require haskell-src-exts >= 1.8.2
#275, add more acknowledgements (still very incomplete)
#254, remove the foldr1/map hint
Compress nested lambdas, \x -> \y -> ... ==> \x y -> ...
Fix minor bug on \x -> \x -> foo x x
#274, add redundant bracket inside record update/construct
#272, don't mess up creating sections from qualified names
Add some hints to suggest elem
Add Paths_hlint to the .cabal file, or the library doesn't link
#271, rewrite the match engine in terms of SYB
#251, add automatic definition hunting with --find
#268, rewrite the (.) expansion in hints to fix various bugs
#269, replacing a case with an if should generate one hint
Document the ANN pragmas
Require haskell-src-exts-1.8.1
Remove a hint replacing do x <- foo; bar x with foo >>= bar
#263, support CPP files more fully
Upgrade to hscolour-1.16
Upgrade to cpphs-1.11
Force cpphs-1.10, since 1.11 breaks the interface
More hints from the Data.Maybe module
#262, add support for the TupleSections extension
#264, upgrade to haskell-src-exts-1.8.*, fixes QuasiQuote pos
Upgrade to cpphs 1.10
#266, don't match hints that appear to be the definitions
#248, tone down the eta reduction hints
Add support for WARNING pragma's to reclassify hints
Support ignoring hints on types
Give better error messages on incorrect settings files
Add temporary haskell-src-exts 1.5/1.6 compatibility
#327, add hints to use expressions infix
#240, if a then True else False no longer suggests a || False
Upgrade to haskell-src-exts-1.7.*
#236, support changing the text encoding with --encoding/--utf8
#260, generate nicer lambdas for (($) . f)
Add the hint (($) . f) ==> (f $)
Further performance enhancements (for details see my blog)
Update to uniplate 1.5.* (fixes performance bug)
Improve speed based on profiling (roughly twice as fast)
#245, add hints for excess brackets in types and patterns
Make 100% redundant brackets an error
Fix bug where qualified names did not match
Remove dependency on SYB
#234, allow TH top-level splices for ignore
#110, add tests for ignoring commands
Upgrade to uniplate 1.4.* (fixes performance bug)
#192, make HLint into a fairly basic library
Add --datadir to allow running with a different data directory
#254, eliminate foldl/map fusion rules (which were untrue)
Fix a few typos in the hint rules
Upgrade to uniplate 1.3.*
Upgrade to haskell-src-exts 1.6.*
Add a .ghci file snippet
#247, Fix bug matching expressions containing position info
Upgrade to haskell-src-exts 1.5.*
#246, redundant brackets in [(...)]
Add fold/map fusion hints
Don't suggest namings that are already used in the module
#239, Add suggestions of and/or on foldl
Add --extension flag, to find files not named .hs/.lhs
Only activate the builtin hints when they are imported
Fix matching bug, said "Use flip" on "\v -> f v . g"
Suggest changing some pattern guards to view patterns
Fix a bug with ignored hints being written to reports
Upgrade to haskell-src-exts 1.3.*
#228, suggest let instead of <- return in do statements
#229, suggest comparing
Qualify all non-Prelude function suggestions
#225, Add redundant flip hint
#226, Add ((+) x) ==> (x +)
#223, TemplateHaskell may allow other extensions via code
Fix incorrect suggestion on do x <- f ; g x x
A few small additional hints (use flip, redundant id)
Don't perform type eta reduction
Fix bug, eta reduction on chained infix operators, i.e. x#y#z
#217, don't suggest eta reduction on - or +
Fix bug, PatternGuards under case alternatives were ignored
#213, upgrade to cpphs 1.9
Add suggestion to replace lambda with operator sections
Fix bug, ''Name decided TemplateHaskell was unnecessary
HPC statistics, and increase in test coverage
Fix bug, import A as Y; import A gave import A, missing the as Y
Fix bug, type Foo a = Bar a a incorrectly suggested eta reduce
NOTE: #213 has not been fixed, cpphs can cause hangs
Add threaded flag to Cabal to disable -threaded mode
#212, fix crash
Fix bug, incorrectly decided TemplateHaskell was unnecessary
Upgrade to hscolour 1.15
Add a hint for using unless
#211, add hints for unused extensions
#188, add pragma hints
Add a few additional hints (Functor laws)
#137, add cpphs support
#189, give hints for redundant imports
Upgrade to haskell-src-exts 1.1.*
#206, better presentation of parse errors
#208, give the correct precedence to ==> in source files
Start of changelog
comments powered byDisqus