Ormolu is a Haskell source code formatter that applies a consistent style without requiring extensive configuration. It is designed to keep formatting predictable while minimising unnecessary changes between versions of a file.
The program uses GHC’s parser to understand Haskell syntax, including modern language extensions. It takes the existing layout into account when deciding whether expressions should remain on one line or span several lines. Formatting is idempotent, so running Ormolu repeatedly produces the same result.
Ormolu can format files directly or check whether they follow its formatting conventions without modifying them. It also supports formatting selected regions, excluding sections using special comments and recognising operator fixities from project dependencies.
The formatter integrates with Haskell Language Server and can be used with editors such as Emacs, Vim and Visual Studio Code. It also supports automated checks in continuous integration pipelines.
This is free and open source software.
Key Features
- Formats Haskell source code using GHC’s parser and a consistent, largely fixed style.
- Preserves selected layout decisions to minimise unnecessary diffs.
- Supports modern Haskell language extensions and detects project settings from Cabal files.
- Provides in-place formatting and a check mode for identifying unformatted files.
- Supports formatting selected regions and excluding code using special comments.
- Recognises operator fixities and module re-exports, with overrides available through configuration files.
- Produces idempotent output, ensuring repeated formatting does not change already formatted code.
- Integrates with Haskell Language Server and automated formatting checks.
Website: github.com/tweag/ormolu
Support:
Developer: Tweag I/O
License: BSD 3-Clause License
Ormolu 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.
Explore our carefully curated directory of recommended free and open source software, covering every major software category.The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more. Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form. |


Please read our Comment Policy before commenting.