Skip to content

Commit de41a93

Browse files
committed
Apply fourmolu
1 parent 62c6d6c commit de41a93

File tree

6 files changed

+69
-48
lines changed

6 files changed

+69
-48
lines changed

.cursorignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
*.uplc
2+
*.plc
3+
*.pir
4+
*.plc-agda
5+
*.sig
6+
*.size
7+
*.budget
8+
*.golden
9+
*.type
10+
*.eval
11+
*.benchmark
12+
*.astsize
13+
*.tex
14+
*.json
15+
*.js
16+
*.err
17+
*.expected
18+
*.stat
19+
*.show
20+
*.golden.txt
21+
*.golden.tsv
22+
*.golden.tplc

.stylish-haskell.yaml

Lines changed: 0 additions & 33 deletions
This file was deleted.

fourmolu.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
indentation: 2
33

44
# Max line length for automatic line breaking
5-
column-limit: 100
5+
column-limit: none
66

77
# Styling of arrows in type signatures (choices: trailing, leading, or leading-args)
88
function-arrows: leading
@@ -11,22 +11,22 @@ function-arrows: leading
1111
comma-style: leading
1212

1313
# Styling of import/export lists (choices: leading, trailing, or diff-friendly)
14-
import-export-style: diff-friendly
14+
import-export-style: leading
1515

1616
# Whether to full-indent or half-indent 'where' bindings past the preceding body
17-
indent-wheres: false
17+
indent-wheres: true
1818

1919
# Whether to leave a space before an opening record brace
20-
record-brace-space: false
20+
record-brace-space: true
2121

2222
# Number of spaces between top-level declarations
2323
newlines-between-decls: 1
2424

2525
# How to print Haddock comments (choices: single-line, multi-line, or multi-line-compact)
26-
haddock-style: multi-line-compact
26+
haddock-style: multi-line
2727

2828
# How to print module docstring
29-
haddock-style-module: null
29+
haddock-style-module: multi-line
3030

3131
# Styling of let blocks (choices: auto, inline, newline, or mixed)
3232
let-style: auto
@@ -35,10 +35,10 @@ let-style: auto
3535
in-style: right-align
3636

3737
# Whether to put parentheses around a single constraint (choices: auto, always, or never)
38-
single-constraint-parens: always
38+
single-constraint-parens: never
3939

4040
# Whether to put parentheses around a single deriving class (choices: auto, always, or never)
41-
single-deriving-parens: auto
41+
single-deriving-parens: always
4242

4343
# Output Unicode syntax (choices: detect, always, or never)
4444
unicode: never

nix/fourmolu.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# We maintain a fork of fourmolu that fixes some issues with the upstream version.
2+
3+
{ pkgs, lib }:
4+
5+
ghc:
6+
7+
let
8+
9+
attrs = {
10+
"ghc96".rev = "0.17.0.0";
11+
"ghc96".sha256 = "sha256-SzPmmpLOkRF6eLSSFzw/ZV1ERPvQOuIPfhZ/gpNpfZQ=";
12+
13+
"ghc912".rev = "0.19.0.1";
14+
"ghc912".sha256 = "sha256-8A+LkCoXJj0edVe6lYEk5o0Nra+MC2Qm6i5Bribp1g4=";
15+
}.${ghc};
16+
17+
fourmolu-project = pkgs.haskell-nix.cabalProject' {
18+
src = pkgs.fetchFromGitHub {
19+
owner = "zeme-wana";
20+
repo = "fourmolu";
21+
inherit (attrs) rev sha256;
22+
};
23+
compiler-nix-name = ghc;
24+
};
25+
26+
in
27+
28+
fourmolu-project.hsPkgs.fourmolu.components.exes.fourmolu

nix/outputs.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ let
3232
project = import ./project.nix
3333
{ inherit inputs pkgs lib metatheory r-with-packages utils; };
3434

35+
mkFourmolu = import ./fourmolu.nix
36+
{ inherit pkgs lib; };
37+
3538
mkShell = ghc: import ./shell.nix
36-
{ inherit inputs pkgs lib project agda-tools metatheory r-with-packages ghc; };
39+
{ inherit inputs pkgs lib project agda-tools metatheory r-with-packages ghc mkFourmolu; };
3740

3841
exposed-haskell-packages = {
3942
plutus-core-test = project.flake'.packages."plutus-core:test:plutus-core-test";

nix/shell.nix

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# editorconfig-checker-disable-file
22

3-
{ inputs, pkgs, lib, project, agda-tools, metatheory, r-with-packages, ghc }:
3+
{ inputs, pkgs, lib, project, agda-tools, metatheory, r-with-packages, ghc, mkFourmolu }:
44

55
let
66

@@ -10,14 +10,14 @@ let
1010
"ghc96".cabal-fmt = project.projectVariants.ghc96.tool "cabal-fmt" "latest";
1111
"ghc96".haskell-language-server = project.projectVariants.ghc96.tool "haskell-language-server" "latest";
1212
"ghc96".stylish-haskell = project.projectVariants.ghc96.tool "stylish-haskell" "latest";
13-
"ghc96".fourmolu = project.projectVariants.ghc96.tool "fourmolu" "0.17.0.0"; # fourmolu 0.18.0.0 and hlint 3.10 require GHC >=9.8
13+
"ghc96".fourmolu = mkFourmolu ghc;
1414
"ghc96".hlint = project.projectVariants.ghc96.tool "hlint" "3.8";
1515

1616
"ghc912".cabal = project.projectVariants.ghc912.tool "cabal" "latest";
1717
"ghc912".cabal-fmt = project.projectVariants.ghc96.tool "cabal-fmt" "latest"; # cabal-fmt not buildable with ghc9122
1818
"ghc912".haskell-language-server = project.projectVariants.ghc912.tool "haskell-language-server" "latest";
1919
"ghc912".stylish-haskell = project.projectVariants.ghc912.tool "stylish-haskell" "latest";
20-
"ghc912".fourmolu = project.projectVariants.ghc912.tool "fourmolu" "latest";
20+
"ghc912".fourmolu = mkFourmolu ghc;
2121
"ghc912".hlint = project.projectVariants.ghc912.tool "hlint" "latest";
2222
};
2323

@@ -36,15 +36,16 @@ let
3636
package = tools.cabal-fmt;
3737
};
3838
stylish-haskell = {
39-
enable = true;
39+
enable = false;
4040
package = tools.stylish-haskell;
4141
args = [ "--config" ".stylish-haskell.yaml" ];
4242
excludes = [ "^plutus-metatheory/src/MAlonzo" ];
4343
};
4444
fourmolu = {
45-
enable = false;
45+
enable = true;
4646
package = tools.fourmolu;
47-
args = [ "--mode" "inplace" ];
47+
args = [ "--unsafe" ];
48+
excludes = [ "^plutus-metatheory/src/MAlonzo" ];
4849
};
4950
hlint = {
5051
enable = false;

0 commit comments

Comments
 (0)