Configuration
Configuration options may be specified in either a fourmolu.yaml
file or via command-line options. Fourmolu looks for a fourmolu.yaml
file in all parents of the current directory, followed by the XDG config directory.
A configuration file with the default values filled in can be generated with:
$ fourmolu --print-defaults > fourmolu.yaml
For example, the indentation
option may be specified in fourmolu.yaml
as:
indentation: 2
or on the command line as --indentation 2
or --indentation=2
.
Every option also has a setting that matches Ormolu's formatting.
Available options
Option name | Description |
---|---|
indentation |
Number of spaces per indentation step |
column-limit |
Max line length for automatic line breaking |
function-arrows |
Styling of arrows in type signatures |
comma-style |
How to place commas in multi-line lists, records, etc. |
import-export-style |
Styling of import/export lists |
indent-wheres |
Whether to full-indent or half-indent 'where' bindings past the preceding body |
record-brace-space |
Whether to leave a space before an opening record brace |
newlines-between-decls |
Number of spaces between top-level declarations |
haddock-style |
How to print Haddock comments |
haddock-style-module |
How to print module docstring |
let-style |
Styling of let blocks |
in-style |
How to align the 'in' keyword with respect to the 'let' keyword |
single-constraint-parens |
Whether to put parentheses around a single constraint |
single-deriving-parens |
Whether to put parentheses around a single deriving class |
unicode |
Output Unicode syntax |
respectful |
Give the programmer more choice on where to insert blank lines |
fixities |
Fixity information for operators |
reexports |
Module reexports Fourmolu should know about |
import-grouping |
Rules for grouping import declarations |
local-modules |
Modules defined by the current Cabal package for import grouping |
sort-constraints |
Whether to sort constraints |