Fourmolu – formatter for Haskell source code

Fourmolu is a Haskell source code formatter based on Ormolu. It retains the original project’s emphasis on consistent formatting and minimal diffs, but gives developers greater control over the appearance of their code.

Like Ormolu, it uses GHC’s parser and supports modern Haskell language extensions. The main difference is its configurable formatting style. Indentation, layout preferences and other formatting decisions can be adjusted through command-line options or a YAML configuration file.

Fourmolu can process individual files, entire directories or selected regions of source code. It also offers a check mode for identifying files that do not follow the project’s formatting conventions, making it useful in automated build pipelines.

Integration with Haskell Language Server allows Fourmolu to be used from compatible editors. The project continues to incorporate improvements from Ormolu while maintaining its own configurable formatting options.

This is free and open source software.

Key Features

  • Formats Haskell source code using GHC’s parser, with configurable layout and indentation rules.
  • Supports project-specific formatting through fourmolu.yaml configuration files.
  • Processes individual files, directories and selected regions of source code.
  • Provides in-place formatting and a check mode for continuous integration workflows.
  • Automatically detects language extensions and dependencies from Cabal files.
  • Supports custom operator fixities and module re-export declarations.
  • Allows formatting to be disabled for selected sections using special comments.
  • Integrates with Haskell Language Server and compatible editors.

Website: github.com/fourmolu/fourmolu
Support:
Developer: Matt Parsons and contributors
License: BSD 3-Clause License

Fourmolu is written in Haskell. Learn Haskell with our recommended free books and free tutorials.


Related Software

Haskell Linters
OrmoluFormatter for Haskell source code
HLintSuggests improvements to Haskell code
FourmoluFormatter for Haskell source code, fork of Ormolu
LiquidHaskellRefinement type checker for verifying properties of Haskell code
stylish-haskellSimple Haskell code prettifier
hindentExtensible Haskell pretty printer
StanHaskell STatic ANalyser
FloskellFlexible Haskell source code pretty printer
WeederPerform whole-program dead-code analysis

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted