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 | |
|---|---|
| Ormolu | Formatter for Haskell source code |
| HLint | Suggests improvements to Haskell code |
| Fourmolu | Formatter for Haskell source code, fork of Ormolu |
| LiquidHaskell | Refinement type checker for verifying properties of Haskell code |
| stylish-haskell | Simple Haskell code prettifier |
| hindent | Extensible Haskell pretty printer |
| Stan | Haskell STatic ANalyser |
| Floskell | Flexible Haskell source code pretty printer |
| Weeder | Perform whole-program dead-code analysis |
Read our verdict in the software roundup.
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. |


Please read our Comment Policy before commenting.