Skip to content

Commit 63ce020

Browse files
committed
Switch to fourmolu (RIP brittany)
1 parent f754e7f commit 63ce020

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,13 @@ For quick reference about Git commands and concepts, see John's
7676
- Follow the recommended code style.
7777

7878
- For Haskell code, refer to [Kowainik's style guide][kowainik-style],
79-
format using [Brittany][brittany], and lint using [hlint][hlint].
79+
format using [Fourmolu][fourmolu], and lint using [hlint][hlint].
8080

8181
- For C code, refer to [Majerle's style guide][majerle-style], format using
8282
[clang-format][clang-format], and lint using [clang-tidy][clang-tidy].
8383

8484
[git-style]: https://commit.style/
8585
[kowainik-style]: https://kowainik.github.io/posts/2019-02-06-style-guide
86-
[brittany]: https://github.com/lspitzner/brittany
87-
[hlint]: https://hackage.haskell.org/package/hlint
8886
[majerle-style]: https://github.com/MaJerle/c-code-style
8987
[clang-format]: https://clang.llvm.org/docs/ClangFormat.html
9088
[clang-tidy]: https://clang.llvm.org/extra/clang-tidy/
@@ -151,7 +149,7 @@ language, and is developed using the following tools:
151149
- [Stack][stack]: project manager
152150
- [Haddock][haddock]: code documentation generator (packaged with Stack)
153151
- [HLS][hls]: [language server][lsp] (optional)
154-
- [Brittany][brittany]: formatter (optional)
152+
- [Fourmolu][fourmolu]: formatter (optional)
155153
- [Hlint][hlint]: linter (optional)
156154

157155
This section will guide you through setting up your development environment with
@@ -170,7 +168,7 @@ these tools.
170168
[haddock]: https://www.haskell.org/haddock/doc/html/index.html
171169
[hls]: https://haskell-language-server.readthedocs.io/en/latest/
172170
[hlint]: https://hackage.haskell.org/package/hlint
173-
[brittany]: https://hackage.haskell.org/package/brittany
171+
[fourmolu]: https://hackage.haskell.org/package/fourmolu
174172
[lsp]: https://langserver.org/
175173
[rosetta2]: https://osxdaily.com/2020/12/04/how-install-rosetta-2-apple-silicon-mac/
176174

@@ -309,11 +307,11 @@ GHC, Cabal, Stack, and HLS. You can read more about its rationale
309307
### Development Tools Setup (optional)
310308

311309
If you are helping develop sslc, you may find it helpful to have [HLint][hlint]
312-
and [Brittany][brittany] available. You can install these with Stack:
310+
and [Fourmolu][fourmolu] available. You can install these with Stack:
313311

314312
```shell
315313
stack install hlint
316-
stack install brittany
314+
stack install fourmolu
317315
```
318316

319317
### Git Alias Setup (optional)
@@ -501,7 +499,7 @@ stack test sslang:scanner-test --ta '--match "/Tests.ScanComments/ignores single
501499

502500
### Linting and Formatting
503501

504-
To keep code on the main branch clean and consistent, you should always make sure to lint (with [Hlint][hlint]) and format (with [Brittany][brittany]) your code before merging any PR. You may invoke Hlint and Brittany manually, but the following [convenience aliases][convenience-aliases] are provided to coordinate with your development workflow.
502+
To keep code on the main branch clean and consistent, you should always make sure to lint (with [Hlint][hlint]) and format (with [Fourmolu][fourmolu]) your code before merging any PR. You may invoke Hlint and Fourmolu manually, but the following [convenience aliases][convenience-aliases] are provided to coordinate with your development workflow.
505503

506504
To lint:
507505

fourmolu.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
indentation: 2
2+
function-arrows: leading
3+
comma-style: leading
4+
import-export-style: diff-friendly
5+
indent-wheres: false
6+
record-brace-space: false
7+
newlines-between-decls: 2
8+
haddock-style: multi-line
9+
haddock-style-module:
10+
let-style: auto
11+
in-style: right-align
12+
respectful: true
13+
fixities: []
14+
unicode: never

scripts/fmt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -euf
55
is_alias="${GIT_PREFIX+y}"
66
pwd="${GIT_PREFIX:-$(pwd)}"
77

8-
haskell_fmt_cmd=("brittany" "--write-mode" "inplace")
8+
haskell_fmt_cmd=("fourmolu" "--mode" "inplace" "-q")
99
haskell_files=()
1010

1111
git_since=""
@@ -35,7 +35,7 @@ function usage () {
3535
echo
3636
echo "But if you just really want to just format all files in this repo:"
3737
echo
38-
echo " find . -name '*.hs' -print0 | xargs -0 brittany --write-mode=inplace"
38+
echo " fourmolu -i ."
3939
}
4040

4141
cd "$(git rev-parse --show-toplevel)"
@@ -96,13 +96,13 @@ if [ "${#haskell_files[@]}" -eq 0 ] ; then
9696
echo "Nothing to format."
9797
fi
9898

99-
if ! which brittany >/dev/null 2>/dev/null ; then
99+
if ! which fourmolu >/dev/null 2>/dev/null ; then
100100
echo
101-
echo "Cannot find brittany on PATH."
101+
echo "Cannot find fourmolu on PATH."
102102
echo
103103
echo "Please install with:"
104104
echo
105-
echo " stack install brittany"
105+
echo " stack install fourmolu"
106106
exit 1
107107
fi
108108

0 commit comments

Comments
 (0)