Fourmolu
Fourmolu is a configurable formatter for Haskell source code and a fork of Ormolu.
What Fourmolu is
Fourmolu is a configurable formatter for Haskell source code and a fork of Ormolu. It uses GHC’s parser and aims for minimal diffs, repeatable formatting, and robustness on large projects. Formatting settings can be placed in a fourmolu.yaml file or supplied as command-line options. Controls cover indentation, line length, import grouping, record layout, Haddock comments, Unicode output, and operator fixities. Fourmolu can locate a source file’s Cabal file and use its default extensions and dependencies to help determine fixities. Users can selectively skip formatting with magic comments or target a line region with command-line options. The project offers an interactive browser demo and documents editor integration through Haskell Language Server. Installation instructions cover GHCup, Cabal, Stack, and dotslash. 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, so check mode can fail on otherwise formatted files with CRLF endings.
Good
- Configurable through YAML or command-line options.
- Offers an interactive browser demo.
- Can use Cabal settings to inform operator fixities.
- Supports selective formatting with comments or line regions.
- Editor integration is documented through Haskell Language Server.
Watch out
- CPP support is experimental and limited to simple cases.
- Always outputs LF line endings.
- Check mode can fail on files with CRLF endings.
Who it suits
It suits Haskell developers who want configurable source formatting, including teams seeking editor or CI integration. Developers using CPP or CRLF line endings should review its stated limitations.
Verdict
Fourmolu provides a range of Haskell formatting controls and installation paths, plus browser and editor options. Its experimental CPP support and LF-only output may matter for some projects.
Plans and prices
From Fourmolu's own pricing page, checked 11 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| Fourmolu | Free | Open-source Haskell formatter |
The facts
Each one read from Fourmolu's own pages, with the date it was checked.
Where it runs
- Browser app
- The project provides a browser-based app, which is redeployed on each new commit to main and may include unreleased changes.checked 11 Oct 2026
What it does
- Cabal awareness
- It locates the relevant Cabal file to read default language extensions and dependencies that help determine operator fixities.checked 11 Oct 2026
- Cabal support
- Fourmolu locates the Cabal file for a source file and uses it to obtain default extensions and dependencies.checked 10 Oct 2026
- CI integration
- The README recommends the run-fourmolu GitHub Action for keeping a project formatted.checked 11 Oct 2026
- Configuration
- Settings can be provided in a fourmolu.yaml file or as command-line options.checked 11 Oct 2026
- Current release
- The site lists v0.21.0.0 as the current release.checked 10 Oct 2026
- Editor integration
- Fourmolu can integrate with editors through Haskell Language Server by setting haskell.formattingProvider to fourmolu.checked 11 Oct 2026
- Formatting controls
- It offers configurable options for indentation, line length, imports, records, comments, and other formatting choices.checked 11 Oct 2026
- GitHub Actions
- The README recommends run-fourmolu to ensure a project is formatted with Fourmolu.checked 10 Oct 2026
- Installation
- The project documents installation through GHCup, Cabal, Stack, and dotslash.checked 11 Oct 2026
- Limitation
- CPP support is experimental and works only in simple cases where conditionals surround top-level declarations.checked 11 Oct 2026
- Limitations
- The README describes CPP support as experimental and says it works only in simple cases where CPP conditionals surround top-level declarations.checked 10 Oct 2026
- Line endings
- Fourmolu always outputs LF line endings, so check mode can fail on otherwise formatted files with CRLF endings.checked 11 Oct 2026
- Maintainer attribution
- The README credits Tweag I/O from 2018–2020 and Matt Parsons from 2020 onward.checked 11 Oct 2026
- Project context
- Fourmolu uses GHC's parser and aims for minimal diffs, idempotent formatting, and support for modern Haskell dialects.checked 11 Oct 2026
- Project metadata
- The repository README says the formatter uses GHC's parser and aims for minimal diffs, idempotence, and robustness on large projects.checked 10 Oct 2026
- Purpose
- Fourmolu formats Haskell source code and is a configurable fork of Ormolu.checked 11 Oct 2026
- Selective formatting
- Magic comments can disable formatting for selected top-level definitions, and command-line options can format a chosen line region.checked 11 Oct 2026
- Support and contributions
- The project invites users to request options and contribute through pull requests.checked 11 Oct 2026
- Support channel
- The README invites users to report desired options and contributions through the project.checked 10 Oct 2026
The full review of Fourmolu
Fourmolu is a free, open-source formatter for Haskell, built for developers who want project-aware formatting they can tune. It suits individual Haskell programmers and teams standardizing a codebase; its Cabal awareness and editor options are useful strengths, while experimental CPP handling and fixed LF output narrow its fit.
Overview
As a configurable fork of Ormolu, Fourmolu formats Haskell using GHC’s parser. The project aims for small diffs, repeatable results and robustness on large projects, qualities that matter when formatting becomes part of regular development: focused changes are easier to review, and idempotent output avoids recurring churn. It also aims to support modern Haskell dialects.
Settings can be kept in fourmolu.yaml or passed as command-line options. Fourmolu finds the Cabal file relevant to a source file and uses its default extensions and dependencies to help resolve operator fixities. That project context is valuable for Cabal-based codebases, though it gives the formatter less relevance to projects that do not use Cabal.
Key features
- Detailed style controls: Options cover indentation, line length, import grouping, record layout, Haddock comments, Unicode output and operator fixities. Teams can set conventions around specific Haskell constructs rather than accept a single inflexible style.
- Selective formatting: Magic comments can exempt selected code, and command-line options can target a line region. This is useful when only part of a file should be reformatted, but selective scope means the project still needs a broader policy for consistent formatting.
- Browser demo: The interactive web app supports configurable formatting and program options, giving users a way to explore output without first setting up a local workflow.
- Editor and CI workflows: The README describes integration through Haskell Language Server by setting haskell.formattingProvider to fourmolu, and recommends the run-fourmolu GitHub Action to keep projects formatted. These options suit teams that want formatting available in their editor and enforced in continuous integration.
- Installation choices: GHCup is the recommended route, with Cabal, Stack and dotslash also documented. That range accommodates different Haskell toolchain setups, although users must choose and maintain an installation path that fits their environment.
Pricing
Fourmolu is free and open source: the Fourmolu plan costs nothing. There is no paid tier or trial to weigh. That makes it a straightforward choice for individual developers and teams that want a Haskell formatter without a software charge, though the project’s open-source model is not a commercial support plan.
Platforms
Fourmolu is listed for web and Windows, with Linux also identified as a platform. The browser demo provides a web option, while the installation guidance covers command-line use. Its supported language is Haskell, so it is not a general-purpose formatter for mixed-language projects.
Who it's for
Fourmolu is best for Haskell developers who want adjustable formatting, project-aware operator fixities and a route into editor or CI automation. Its Cabal lookup makes it particularly relevant to Cabal projects. It is a weaker fit where preprocessing is central: CPP support is experimental and works only in simple cases where conditionals surround top-level declarations. Projects with CRLF line endings also need to account for its LF-only output, since check mode can fail even when the file is otherwise formatted.
Pros and cons
- Pro: Cabal-aware fixity handling uses extensions and dependencies from the relevant project file, which can help formatting reflect project context.
- Pro: A broad set of style controls, selective formatting and editor/CI integration support both local preferences and shared team workflows.
- Con: CPP support is limited to simple top-level conditional cases, making it a risky choice for code that relies on more complex preprocessing.
- Con: LF-only output can cause check mode to fail on CRLF files, a practical drawback for projects that require Windows-style line endings.
Alternatives
Ormolu is the closest alternative to consider if you want a free, open-source Haskell formatter; Fourmolu is itself a configurable fork of Ormolu. For Python, choose Black; for F#, Fantomas; for Rust, rustfmt; and for Zig, Zig fmt, which is included with the Zig toolchain. goimports is a free open-source command-line tool, while Prettier is a free open-source formatter with enterprise support and maintenance offered through Tidelift Subscription. Accessibility Test Framework for Android is another free alternative listed across Android, Linux, macOS and Windows.
For more options, see Code Formatting Tools.
Verdict
Choose Fourmolu if you work in Haskell and want configurable formatting that can draw on Cabal project settings and fit into editor and CI workflows at no software cost. Look elsewhere if your code depends on complex CPP conditionals or needs CRLF-preserving checks: its experimental CPP coverage and LF-only output are meaningful constraints.
Getting started
- Open the Fourmolu website or browser demo
- Install through GHCup, Cabal, Stack, or dotslash
- Create a fourmolu.yaml file or choose command-line options
- Configure Haskell Language Server to use fourmolu
- Add the run-fourmolu GitHub Action for CI formatting
Limits worth knowing
CPP works only in simple cases where conditionals surround top-level declarations. Check mode can fail when otherwise formatted files use CRLF endings because output is always LF.
Questions
Is Fourmolu free?
Yes. Fourmolu is free and open source, with a listed plan price of no cost.
Which platforms are supported?
The listed platforms are Linux, Windows, and web.
What language does Fourmolu format?
It formats Haskell source code.
Can Fourmolu integrate with editors?
Yes. Integration is documented through Haskell Language Server by setting haskell.formattingProvider to fourmolu.
How can it be installed?
The project recommends GHCup and also documents Cabal, Stack, and dotslash installation.
Does Fourmolu offer a browser version?
Yes. The website provides an interactive browser demo with configurable formatting and program options.
Alternatives to Fourmolu
- 1

Prettier
Free planOpen sourceWebAPIExtensionLinux7.5Free plan - 2
Avidemux
Free planOpen sourceWebLinuxmacOSWindows7.3Free plan - 3
rustfmt
Free planLinuxmacOSWindows6.6Free plan - 4
Black
Free planLinuxmacOSSelf-hostedWindows6.5Free plan - 5

Ruff
Free planWebLinuxmacOSSelf-hosted6.5Free plan - 6
Zig fmt
Free planLinuxmacOSWindows6.5Free plan
