Skip to content
SPECIFICTION
Get listed

Fourmolu

fourmolu.github.io

Free plan WebWindowsLinux
Visit fourmolu.github.io
Spec score 8.3 #4 of 34 in Code Formatting Tools

What it is

Fourmolu is a configurable formatter for Haskell source code and a fork of Ormolu. It uses GHC’s parser and aims to keep diffs small, produce idempotent output, and handle large projects. Set formatting options in `fourmolu.yaml` or pass them on the command line. Controls include indentation, line length, import grouping, record layout, Haddock comments, Unicode output, and operator fixities. Fourmolu can find the relevant Cabal file to read default extensions and dependencies that help determine fixities. Magic comments can disable formatting for selected code, and command-line options can target a line region. There is an interactive browser demo with configurable formatting and program options. Installation instructions cover GHCup, Cabal, Stack, and dotslash; editor integration is documented through Haskell Language Server. The project recommends a GitHub Action to keep projects formatted. Its 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, which can cause check mode to fail on CRLF files.

Spec sheet

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

Plans and prices

Fourmolu Free Open-source Haskell formatter Read 11 Oct 2026 · github.com

Every Fourmolu plan and price →

Strong points and limits

Strong points

  • Configurable through YAML or command-line options
  • Can format selected code or line regions
  • Browser demo includes configurable options
  • Documents editor and GitHub Actions integration
  • Reads extensions and dependencies from Cabal files

Limits

  • CPP support is experimental and limited
  • Always outputs LF line endings
  • Listed platforms omit Linux

Who it suits

Fourmolu suits Haskell developers who want configurable formatting, selective formatting, and editor or CI integration. Its Cabal awareness may also help projects whose extensions and operator fixities are declared there.

Verdict

Fourmolu offers detailed Haskell formatting controls, with a browser demo and documented editor and CI workflows. Check its CPP limits and LF output behavior against your project’s needs.

Where Specifiction places it

Alternatives to FourmoluAll alternatives →