Coding

Ormolu – formatter for Haskell source code

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
OrmoluFormatter for Haskell source code
HLintSuggests improvements to Haskell code
FourmoluFormatter for Haskell source code, fork of Ormolu
LiquidHaskellRefinement type checker for verifying properties of Haskell code
stylish-haskellSimple Haskell code prettifier
hindentExtensible Haskell pretty printer
StanHaskell STatic ANalyser
FloskellFlexible Haskell source code pretty printer
WeederPerform whole-program dead-code analysis

Read our verdict in the software roundup.


Best Free and Open Source Software 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.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted