Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

Fourmolu

fourmolu.github.io

  • Free plan
  • Windows
  • Linux
  • Web

What Fourmolu is

Fourmolu is a configurable formatter for Haskell source code and a fork of Ormolu. It uses GHC’s parser and aims to keep changes small and formatting consistent, including on large projects. Settings can go in a fourmolu.yaml file or be supplied as command-line options. Controls cover indentation, line length, import grouping, record layout, Haddock comments, Unicode output, and operator fixities. Fourmolu can find a source file’s Cabal file and use its default extensions and dependencies when determining fixities. Magic comments can exempt selected code from formatting, and command-line options can target a line region. The project offers an interactive browser demo and documents editor integration through Haskell Language Server. Installation instructions cover GHCup, Cabal, Stack, and dotslash. The listed current release is v0.21.0.0. CPP handling is experimental and limited to simple cases where conditionals surround top-level declarations. Output always uses LF line endings, so check mode may fail on files that use CRLF endings.

Who it suits

Fourmolu suits Haskell developers who want configurable formatting in a project, editor, or browser. Its Cabal awareness and selective formatting options may help teams with project-specific settings.

Good to know, and what to watch

  • Free and open source
  • Configurable through YAML or CLI
  • Interactive browser demo
  • Cabal-aware fixity handling
  • Selective formatting controls
  • CPP support is experimental and limited
  • Always outputs LF line endings
  • Check mode can fail on CRLF files

Fourmolu

Free

Open source

Getting started

  1. Open the Fourmolu website to try the interactive browser demo.
  2. Install Fourmolu using GHCup, or follow the documented Cabal, Stack, or dotslash route.
  3. Set formatting preferences in fourmolu.yaml or pass them as command-line options.
  4. For editor formatting, configure Haskell Language Server with haskell.formattingProvider set to fourmolu.
  5. For CI, use the recommended run-fourmolu GitHub Action.

Limits to check

CPP support is experimental and works only in simple cases where CPP conditionals surround top-level declarations. Fourmolu always emits LF line endings, so check mode can fail on otherwise formatted files using CRLF.

The verdict

Fourmolu offers detailed formatting controls and integration paths for Haskell projects. Account for its limited CPP handling and LF-only output when using it in existing workflows.

Questions people ask

How much does Fourmolu cost?

Fourmolu is free and open source; the listed plan is free.

Is there a free plan or trial?

It is free to use, and there is no free trial.

Which platforms does Fourmolu support?

The listed platforms are Linux, web, and Windows.

How can I install it?

The README recommends GHCup and also documents installation with Cabal, Stack, and dotslash.

Can I use Fourmolu in an editor or CI?

The README documents Haskell Language Server integration and recommends the run-fourmolu GitHub Action for CI.

Who maintains Fourmolu?

The README credits Tweag I/O from 2018–2020 and Matt Parsons from 2020 onward.

What the maker publishes

Browser app
The site provides an interactive browser demo with configurable formatting and program options. source
Browser app
The project provides a browser-based app, which is redeployed on each new commit to main and may include unreleased changes. source
Cabal awareness
It locates the relevant Cabal file to read default language extensions and dependencies that help determine operator fixities. source
Cabal support
Fourmolu locates the Cabal file for a source file and uses it to obtain default extensions and dependencies. source
CI integration
The README recommends the run-fourmolu GitHub Action for keeping a project formatted. source
Configuration
Formatting options can be set in a fourmolu.yaml file or through command-line options. source
Configuration
Settings can be provided in a fourmolu.yaml file or as command-line options. source
Current release
The site lists v0.21.0.0 as the current release. source
Editor integration
The README says Fourmolu can be integrated with an editor through Haskell Language Server by setting haskell.formattingProvider to fourmolu. source
Editor integration
Fourmolu can integrate with editors through Haskell Language Server by setting haskell.formattingProvider to fourmolu. source
Formatting controls
Options include indentation, line length, import grouping, record layout, Haddock comments, Unicode output, and operator fixities. source
Formatting controls
It offers configurable options for indentation, line length, imports, records, comments, and other formatting choices. source
GitHub Actions
The README recommends run-fourmolu to ensure a project is formatted with Fourmolu. source
Installation
The project README recommends installation with GHCup and also documents Cabal, Stack, and dotslash installation. source
Installation
The project documents installation through GHCup, Cabal, Stack, and dotslash. source
Limitation
CPP support is experimental and works only in simple cases where conditionals surround top-level declarations. source
Limitations
The README describes CPP support as experimental and says it works only in simple cases where CPP conditionals surround top-level declarations. source
Line endings
Fourmolu always outputs LF line endings, so check mode can fail on otherwise formatted files with CRLF endings. source
Maintainer attribution
The README credits Tweag I/O from 2018–2020 and Matt Parsons from 2020 onward. source
Project context
Fourmolu uses GHC's parser and aims for minimal diffs, idempotent formatting, and support for modern Haskell dialects. source
Project metadata
The repository README says the formatter uses GHC's parser and aims for minimal diffs, idempotence, and robustness on large projects. source
Purpose
Fourmolu formats Haskell source code and is a configurable fork of Ormolu. source
Purpose
Fourmolu formats Haskell source code and is a configurable fork of Ormolu. source
Selective formatting
Magic comments can disable formatting for selected code, and command-line options can format a specified line region. source

Checked against the maker's pages on 11 Oct 2026.