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.
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.