LinuxCommandLibrary

hlint

Suggest improvements for Haskell code

TLDR

Display suggestions for a given file

$ hlint [path/to/file] options
copy

Check all Haskell files and generate a report
$ hlint [path/to/directory] --report
copy

Automatically apply most suggestions
$ hlint [path/to/file] --refactor
copy

Display additional options
$ hlint [path/to/file] --refactor-options
copy

Generate a settings file ignoring all outstanding hints
$ hlint [path/to/file] --default > [.hlint.yaml]
copy

SYNOPSIS

hlint [OPTIONS] [FILES]

PARAMETERS

--version
    Display the version number.

--help
    Display help information.

--cpp
    Run the C preprocessor on the files.

--ignore
    Ignore a specific error.

--report
    Produce a report of suggestions.

--refactor
    Apply suggestions directly to the files.

--no-color
    Disable colored output.

--output
    Specify the output file for the report.

--with-ghc
    Specify which ghc to use.

DESCRIPTION

hlint is a tool that analyzes Haskell code and suggests improvements. It can identify potential bugs, style issues, and opportunities for simplification. It uses a flexible rule-based system, allowing users to customize the checks performed.

hlint aims to improve code quality and maintainability by providing automated feedback on code style and correctness. It can be integrated into development workflows, such as CI/CD pipelines, to ensure code adheres to defined standards. The tool is language-aware, specifically designed to work with Haskell's syntax and semantics, and is capable of offering refactoring suggestions.

CAVEATS

hlint relies on a rule-based system, so its effectiveness depends on the quality and comprehensiveness of the rules. Customizing rules may require knowledge of Haskell's syntax and semantics.

RULE CONFIGURATION

hlint's behavior is controlled by rules specified in .hlint.yaml files. These files define the checks to be performed and the suggestions to be made.

INTEGRATION

hlint can be integrated into various IDEs and build systems, providing real-time feedback on code quality.

HISTORY

hlint was developed as a practical tool for improving Haskell code quality. It has evolved over time, with contributions from various developers, to include a wider range of checks and refactoring suggestions. It is widely used in the Haskell community.

SEE ALSO

ghc(1), ghci(1)

Copied to clipboard