A formatter for Haskell source code
open sourceBSD-3-Clauseself-hostablefree
Ormolu is a formatter for Haskell source code that uses GHC's own parser, so it handles modern Haskell syntax and extensions. It has one style with no configuration, but the input's layout guides the output: whether a construct is on one line or several is your choice, while the result stays consistent. It aims for minimal diffs and is idempotent, so formatting formatted code changes nothing. It runs from the command line (binaries for Linux, macOS and Windows), inside haskell-language-server, in Emacs, VS Code and Vim, in CI with the run-ormolu GitHub Action, in the browser with Ormolu Live (ormolu-live.tweag.io), and as a library. Tweag maintains it, BSD-3-Clause licensed.
Problems it solves
- format Haskell code consistently across a team without arguing about style
- a Haskell formatter with no configuration to maintain
- check in CI that every Haskell file in a project is formatted
- format Haskell on save in VS Code or Emacs
- a Haskell formatter that understands modern GHC extensions
- keep formatting diffs small when reformatting Haskell code
Features
- uses GHC's own parser
- one style with no configuration
- input layout chooses single-line or multi-line output
- minimal diffs and idempotent output
- magic comments and regions to leave code unformatted
- binaries for Linux, macOS and Windows
- built into haskell-language-server
- Emacs, VS Code and Vim integrations
- run-ormolu GitHub Action
- Ormolu Live in the browser
View 1 more
- usable as a Haskell library
Limitations
- CPP support is experimental: Ormolu leaves CPP sections unchanged, which works only when conditionals surround top-level declarations
Capabilities
| Has a command line tool | plan not known |
|---|
Alternatives
The same job
These do what Ormolu does.
