brittany: Haskell source code formatter

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

See the README.

If you are interested in the implementation, have a look at this document;

The implementation is documented in more detail here.

[Skip to Readme]


Change log
Dependencies aeson (>= && <1.5), base (>=4.9 && <4.13), brittany, butcher (>=1.3.1 && <1.4), bytestring (>= && <0.11), cmdargs (>=0.10.14 && <0.11), containers (>= && <0.7), czipwith (>= && <1.1), data-tree-print, deepseq (>= && <1.5), directory (>= && <1.4), extra (>=1.4.10 && <1.7), filepath (>= && <1.5), ghc (>=8.0.1 && <8.7), ghc-boot-th (>=8.0.1 && <8.7), ghc-exactprint (>=0.5.8 && <0.6.2), ghc-paths (>= && <0.2), monad-memo (>=0.4.1 && <0.6), mtl (>=2.2.1 && <2.3), multistate (>= && <0.9), neat-interpolation (>=0.3.2 && <0.4), pretty (>= && <1.2), random (>=1.1 && <1.2), safe (>=0.3.9 && <0.4), semigroups (>=0.18.2 && <0.19), strict (>=0.3.2 && <0.4), syb (>=0.6 && <0.8), text (>=1.2 && <1.3), transformers (>= && <0.6), uniplate (>=1.6.12 && <1.7), unsafe (>=0.0 && <0.1), yaml (>=0.8.18 && <0.12) [details]
License AGPL-3.0-only
Copyright Copyright (C) 2016-2019 Lennart Spitzner Copyright (C) 2019 PRODA LTD
Author Lennart Spitzner
Maintainer Lennart Spitzner <>
Category Language
Home page
Bug tracker
Source repo head: git clone
Uploaded by lspitzner at 2019-06-19T08:40:28Z


[Index] [Quick Jump]


Manual Flags


set buildable false for anything but lib


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Readme for brittany-

[back to package description]

brittany Hackage version Stackage version Build Status

haskell source code formatter

Output sample

(see more examples and comparisons)

This project's goals roughly are to:

In theory, the core algorithm inside brittany reaches these goals. It is rather clever about making use of horizontal space while still being linear in the size of the input (although the constant factor is not small). See these examples of clever layouting.

But brittany is not finished yet, and there are some open issues that yet require fixing:

Try without Installing

You can paste haskell code over here to test how it gets formatted by brittany. (Rg. privacy: the server does log the size of the input, but not the full input/output of requests.)

Other usage notes


Editor Integration

Sublime text

In this gist I have described a haskell setup that includes a shortcut to run brittany formatting.


This extension connects commandline brittany to VSCode formatting API. Thanks to @MaxGabriel.


haskell-ide-engine includes a brittany plugin that directly uses the brittany library. Relevant for any editors that properly support the language-server-protocol.

Neovim / Vim 8

The Neoformat plugin comes with support for brittany built in.


Atom Beautify supports brittany as a formatter for Haskell. Since the default formatter is set to hindent, you will need to change this setting to brittany, after installing the extension.


format-all support brittany as the default formatter for Haskell.


Feature Requests, Contribution, Documentation

For a long time this project has had a single maintainer, and as a consequence there have been some mildly large delays for reacting to feature requests and even PRs.

Sorry about that.

The good news is that this project is getting sponsored by PRODA LTD, and two previous contributors, Evan Borden and Taylor Fausak, have agreed on helping with organisational aspects. Thanks!

Still, this project has a long queue of very sensible feature requests, so it may take some time until new ones get our attention. But with the help of the co-maintainers, at least the reaction-times on PRs and the frequency of releases should improve significantly.

If you are interested in making your own contributions, there is a good amount of high-level documentation at

the documentation index


Copyright (C) 2016-2019 Lennart Spitzner
Copyright (C) 2019 PRODA LTD

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see