Skip to content

Commit 4f3a751

Browse files
authored
Format code with fourmolu (#2382)
* entr.sh: Fix regular expression for finding Haskell source files * shell.nix: Add fourmolu * hooks.sh: Use fourmolu * Run fourmolu instead of stylish-haskell in Update workflow * Run fourmolu in Test workflow * Fix Haddock errors * Update fourmolu * shell.nix: buildInputs = fd * Format with fourmolu * Add scripts/remove-import-groups.sh * nix/fourmolu.sh: Run scripts/remove-import-groups.sh * scripts/fourmolu.sh: Add script that can run outside Nix * scripts/remove-import-groups.sh: Fix syntax error * Format with fourmolu * Trigger workflows * Add scripts/resolve-conflicts.sh * Format with fourmolu Co-authored-by: ttuegel <[email protected]>
1 parent 78515d1 commit 4f3a751

File tree

582 files changed

+67999
-66707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

582 files changed

+67999
-66707
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,24 +148,32 @@ jobs:
148148
- name: Run hlint
149149
run: curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s kore -j
150150

151-
stylish-haskell:
152-
name: 'stylish-haskell'
151+
fourmolu:
152+
name: 'Style'
153153
runs-on: ubuntu-latest
154154
steps:
155-
- name: Install stylish-haskell
156-
run: |
157-
cd $(mktemp -d)
158-
wget https://github.com/jaspervdj/stylish-haskell/releases/download/v0.11.0.0/stylish-haskell-v0.11.0.0-linux-x86_64.tar.gz
159-
tar xaf stylish-haskell-v0.11.0.0-linux-x86_64.tar.gz
160-
sudo mv stylish-haskell-v0.11.0.0-linux-x86_64/stylish-haskell /usr/local/bin/
161-
stylish-haskell --version
162-
163-
- uses: actions/[email protected]
155+
- name: Check out code
156+
uses: actions/[email protected]
164157
with:
165158
submodules: recursive
166159

167-
- name: Format with stylish-haskell
168-
run: stylish-haskell -i -r kore
160+
- name: Install Nix
161+
uses: cachix/install-nix-action@v12
162+
with:
163+
extra_nix_config: |
164+
substituters = http://cache.nixos.org https://hydra.iohk.io
165+
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
166+
167+
- name: Install Cachix
168+
uses: cachix/cachix-action@v8
169+
with:
170+
name: kore
171+
signingKey: '${{ secrets.KORE_CACHIX_SIGNING_KEY }}'
172+
skipPush: true
173+
174+
- name: Format
175+
run: |
176+
./nix/fourmolu.sh
169177
170178
- name: Check for changes
171179
run: |

.github/workflows/update.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,36 @@ jobs:
3737
commit_message: 'Materialize Nix expressions'
3838
file_pattern: 'nix/ *.cabal'
3939

40-
stylish-haskell:
41-
name: 'stylish-haskell'
40+
fourmolu:
41+
name: 'Style'
4242
runs-on: ubuntu-latest
4343
steps:
44-
- name: Install stylish-haskell
45-
run: |
46-
cd $(mktemp -d)
47-
wget https://github.com/jaspervdj/stylish-haskell/releases/download/v0.11.0.0/stylish-haskell-v0.11.0.0-linux-x86_64.tar.gz
48-
tar xaf stylish-haskell-v0.11.0.0-linux-x86_64.tar.gz
49-
sudo mv stylish-haskell-v0.11.0.0-linux-x86_64/stylish-haskell /usr/local/bin/
50-
stylish-haskell --version
51-
52-
- uses: actions/[email protected]
44+
- name: Check out code
45+
uses: actions/[email protected]
5346
with:
5447
submodules: recursive
5548

56-
- name: Format with stylish-haskell
57-
run: stylish-haskell -i -r kore
49+
- name: Install Nix
50+
uses: cachix/install-nix-action@v12
51+
with:
52+
extra_nix_config: |
53+
substituters = http://cache.nixos.org https://hydra.iohk.io
54+
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
55+
56+
- name: Install Cachix
57+
uses: cachix/cachix-action@v8
58+
with:
59+
name: kore
60+
signingKey: '${{ secrets.KORE_CACHIX_SIGNING_KEY }}'
61+
skipPush: true
62+
63+
- name: Format
64+
run: |
65+
./nix/fourmolu.sh
5866
5967
- name: Commit changes
6068
uses: stefanzweifel/[email protected]
6169
with:
62-
commit_message: 'Format with stylish-haskell'
70+
commit_message: 'Format with fourmolu'
71+
file_pattern: '*.hs'
72+

entr.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ last=2 # last exit code
1515
# This way, the script exits if the user interrupts it (for example).
1616
while test "$last" -eq 2
1717
do
18-
fd '(package.yaml|.*.hs)' | entr -d -s "${@:-./hooks.sh}"
18+
fd '(package.yaml|.*\.hs)' | entr -d -s "${@:-./hooks.sh}"
1919
last=$?
2020
done

fourmolu.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
indentation: 4
2+
comma-style: leading # for lists, tuples etc. - can also be 'trailing'
3+
record-brace-space: false # rec {x = 1} vs. rec{x = 1}
4+
indent-wheres: false # 'false' means save space by only half-indenting the 'where' keyword
5+
diff-friendly-import-export: true # 'false' uses Ormolu-style lists
6+
respectful: true # don't be too opinionated about newlines etc.
7+
haddock-style: multi-line # '--' vs. '{-'
8+
newlines-between-decls: 1 # number of newlines between top-level declarations

hooks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# hooks: run these commands when project files change
44

55
hpack -f kore
6-
stylish-haskell -i -r kore
6+
fd '.*\.hs' | xargs fourmolu -o -XTypeApplications -o -XPatternSynonyms -o -XBangPatterns -i

kore/Setup.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import Distribution.Simple
2+
23
main = defaultMain

0 commit comments

Comments
 (0)