LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

brittany

Format Haskell source code

TLDR

Format file and output to stdout
$ brittany [source.hs]
copy
Format from stdin
$ cat [source.hs] | brittany
copy
Format files in place
$ brittany --write-mode=inplace [*.hs]
copy
Check formatting without modifying
$ brittany --check-mode [source.hs]
copy
Use specific config file
$ brittany --config-file [brittany.yaml] [source.hs]
copy
Set column limit
$ brittany --columns [100] [source.hs]
copy

SYNOPSIS

brittany [options] [files]

DESCRIPTION

brittany is a Haskell source code formatter that focuses on horizontal space utilization. It reformats code to make maximal use of available width while avoiding lines that are too long.The formatter uses ghc-exactprint as the parser, supporting full GHC Haskell including extensions.

PARAMETERS

--write-mode mode

Output mode: stdout, inplace, or display
--check-mode
Exit with error if formatting would change
--columns n
Maximum line width (default: 80)
--indent n
Indentation width (default: 2)
--config-file file
Use specific configuration file
--no-user-config
Ignore user configuration file

CONFIGURATION

Default user config: ~/.config/brittany/config.yamlProject config: First brittany.yaml found in current or parent directories.GHC extensions can be enabled in config:

$ conf_forward:
  options_ghc:
    - -XLambdaCase
    - -XMultiWayIf
copy

CAVEATS

Some less common Haskell syntax elements are not fully supported. In-source comments may occasionally be moved or lost. This project is effectively unmaintained; consider using Ormolu or Fourmolu instead.

SEE ALSO

Copied to clipboard
Kai