LinthelmIntroductions to linters, static analysis and code-quality tools

Linters

What is HLint? An introduction to Neil Mitchell's Haskell linter

By the Linthelm editorial team · Published · Updated

HLint is a tool that suggests possible improvements to Haskell code. Its suggestions include using alternative functions, simplifying code and spotting redundancies. It is aimed at Haskell developers.

Tool
HLint
Made by
Neil Mitchell
Official site
github.com/ndmitchell/hlint
Category
Linters

Who makes HLint

HLint is made by Neil Mitchell. The official website is the project's GitHub repository, linked below this page, which is the place to go for the source and the current documentation.

Official website: github.com/ndmitchell/hlint

What HLint is for

HLint reads Haskell source and points out places where the code could be better. A hint might suggest swapping in an alternative function, writing a piece of code in a simpler way, or removing something redundant.

Each hint carries a severity, such as warning or suggestion, and shows both the code it found and a suggested replacement. That makes a hint easy to evaluate: you see what is there, what HLint proposes instead, and how seriously it rates the difference.

HLint analyses each module in isolation, so it does not know about types or which names are in scope. This is a deliberate design choice, and it shapes what the tool can and cannot tell you. Its hints come from the shape of the code in a module, not from type information.

Who HLint is for

The vendor states that HLint is for Haskell developers. In practice that covers anyone who writes Haskell and wants a second opinion on how idiomatic or tidy the code is.

Because the per-module design works on code that may not type-check, HLint can be used incrementally while code is still in progress. Teams adding it to an existing codebase can also generate a settings file that ignores all currently outstanding hints, which allows gradual adoption instead of fixing every finding at once.

Notable capabilities

HLint is installed through cabal from Hackage, and a run over a directory searches it recursively for Haskell source files. Beyond basic hints, it has several features for reporting, adoption and automation.

  • Parallelism and incremental use: analysing each module in isolation allows work to run in parallel and lets HLint run on code that may not type-check.
  • Configuration: behaviour is set through a .hlint.yaml file.
  • HTML reports: HLint can generate an HTML report of all issues found, which is useful for reviewing findings outside the terminal.
  • Gradual adoption: it can generate a settings file that ignores all currently outstanding hints.
  • Automatic fixes: the --refactor flag applies some suggestions automatically, and this requires the refactor executable from the apply-refact package.
  • Extension handling: HLint enables most Haskell extensions so it can parse more code, and individual extensions can be toggled.
  • CI support: a prebuilt binary release can be fetched on CI to avoid compilation cost.
  • Editor and tool integration: HLint is part of several Haskell IDEs and tools, and it is available as a GHC plugin.

How HLint fits linters

HLint is a linter in the plain sense of the word: it inspects source code without running it and reports style and simplification issues, each with a severity and a proposed fix. It is specific to Haskell, so it covers one language rather than many.

In Linthelm's wider niche of linters, static analysis and code quality, HLint sits on the lightweight, syntax-level side. Because it does not know about types or names in scope, it complements rather than replaces checks that depend on full type information.

It also connects to the wider workflow. HLint integrates with Code Climate, and Danger can use it to comment on pull requests automatically, so its hints can appear in code review as well as in the editor.

Frequently asked questions

What is HLint used for?

HLint is used to get suggestions for improving Haskell code, such as using alternative functions, simplifying code and removing redundancies. Each hint shows the found code and a suggested replacement.

Who develops HLint?

HLint is made by Neil Mitchell. Its official website is the GitHub repository at https://github.com/ndmitchell/hlint.

Does HLint know about types?

No. HLint analyses each module in isolation, so it does not know about types or which names are in scope. This design allows parallelism and use on code that may not type-check.

Can HLint fix issues automatically?

HLint can apply some suggestions automatically with the --refactor flag. This requires the refactor executable from the apply-refact package.

How do I adopt HLint on an existing codebase?

HLint can generate a settings file that ignores all currently outstanding hints, so you can adopt it gradually. It is configured through a .hlint.yaml file.

Sources. This introduction is based on the vendor's official pages, checked on 22 November 2026 (Asia/Dhaka):

Linthelm is independent and is not affiliated with Neil Mitchell. Product names belong to their owners. Features change; confirm details on the official website.