Skip to content

Format code with fourmolu #2382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
34 changes: 21 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,32 @@ jobs:
- name: Run hlint
run: curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s kore -j

stylish-haskell:
name: 'stylish-haskell'
fourmolu:
name: 'Style'
runs-on: ubuntu-latest
steps:
- name: Install stylish-haskell
run: |
cd $(mktemp -d)
wget https://github.com/jaspervdj/stylish-haskell/releases/download/v0.11.0.0/stylish-haskell-v0.11.0.0-linux-x86_64.tar.gz
tar xaf stylish-haskell-v0.11.0.0-linux-x86_64.tar.gz
sudo mv stylish-haskell-v0.11.0.0-linux-x86_64/stylish-haskell /usr/local/bin/
stylish-haskell --version

- uses: actions/[email protected]
- name: Check out code
uses: actions/[email protected]
with:
submodules: recursive

- name: Format with stylish-haskell
run: stylish-haskell -i -r kore
- name: Install Nix
uses: cachix/install-nix-action@v12
with:
extra_nix_config: |
substituters = http://cache.nixos.org https://hydra.iohk.io
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=

- name: Install Cachix
uses: cachix/cachix-action@v8
with:
name: kore
signingKey: '${{ secrets.KORE_CACHIX_SIGNING_KEY }}'
skipPush: true

- name: Format
run: |
./nix/fourmolu.sh

- name: Check for changes
run: |
Expand Down
38 changes: 24 additions & 14 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,36 @@ jobs:
commit_message: 'Materialize Nix expressions'
file_pattern: 'nix/ *.cabal'

stylish-haskell:
name: 'stylish-haskell'
fourmolu:
name: 'Style'
runs-on: ubuntu-latest
steps:
- name: Install stylish-haskell
run: |
cd $(mktemp -d)
wget https://github.com/jaspervdj/stylish-haskell/releases/download/v0.11.0.0/stylish-haskell-v0.11.0.0-linux-x86_64.tar.gz
tar xaf stylish-haskell-v0.11.0.0-linux-x86_64.tar.gz
sudo mv stylish-haskell-v0.11.0.0-linux-x86_64/stylish-haskell /usr/local/bin/
stylish-haskell --version

- uses: actions/[email protected]
- name: Check out code
uses: actions/[email protected]
with:
submodules: recursive

- name: Format with stylish-haskell
run: stylish-haskell -i -r kore
- name: Install Nix
uses: cachix/install-nix-action@v12
with:
extra_nix_config: |
substituters = http://cache.nixos.org https://hydra.iohk.io
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=

- name: Install Cachix
uses: cachix/cachix-action@v8
with:
name: kore
signingKey: '${{ secrets.KORE_CACHIX_SIGNING_KEY }}'
skipPush: true

- name: Format
run: |
./nix/fourmolu.sh

- name: Commit changes
uses: stefanzweifel/[email protected]
with:
commit_message: 'Format with stylish-haskell'
commit_message: 'Format with fourmolu'
file_pattern: '*.hs'

2 changes: 1 addition & 1 deletion entr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ last=2 # last exit code
# This way, the script exits if the user interrupts it (for example).
while test "$last" -eq 2
do
fd '(package.yaml|.*.hs)' | entr -d -s "${@:-./hooks.sh}"
fd '(package.yaml|.*\.hs)' | entr -d -s "${@:-./hooks.sh}"
last=$?
done
8 changes: 8 additions & 0 deletions fourmolu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
indentation: 4
comma-style: leading # for lists, tuples etc. - can also be 'trailing'
record-brace-space: false # rec {x = 1} vs. rec{x = 1}
indent-wheres: false # 'false' means save space by only half-indenting the 'where' keyword
diff-friendly-import-export: true # 'false' uses Ormolu-style lists
respectful: true # don't be too opinionated about newlines etc.
haddock-style: multi-line # '--' vs. '{-'
newlines-between-decls: 1 # number of newlines between top-level declarations
2 changes: 1 addition & 1 deletion hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# hooks: run these commands when project files change

hpack -f kore
stylish-haskell -i -r kore
fd '.*\.hs' | xargs fourmolu -o -XTypeApplications -o -XPatternSynonyms -o -XBangPatterns -i
1 change: 1 addition & 0 deletions kore/Setup.hs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import Distribution.Simple

main = defaultMain
Loading