Skip to content

Commit

Permalink
Booster-532: align fourmolu and hlint versions (runtimeverification#3756
Browse files Browse the repository at this point in the history
)

Preparing
runtimeverification/hs-backend-booster#532

* Use `fourmolu 0.14.0.0`, reformatting the code as required (large
change)
* use `hlint-3.6.1` to check code style (adjusting code and config as
required)
* provide `hlint-3.6.1` in nix derivation `#fourmolu`

---------

Co-authored-by: github-actions <github-actions@github.com>
  • Loading branch information
jberthold and github-actions authored Apr 4, 2024
1 parent 531f7c1 commit 847aad9
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 43 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
stack-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}
stack-2-${{ runner.os }}-ghc-${{ env.ghc_version }}
- uses: haskell-actions/setup@v2
- uses: haskell-actions/setup@v2.7
id: setup-haskell-stack
with:
ghc-version: ${{ env.ghc_version }}
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
stack-haddock-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}
stack-haddock-2-${{ runner.os }}-ghc-${{ env.ghc_version }}
- uses: haskell-actions/setup@v2.6.1
- uses: haskell-actions/setup@v2.7
id: setup-haskell-stack
with:
ghc-version: ${{ env.ghc_version }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
submodules: recursive

- name: Install Nix
uses: cachix/install-nix-action@v25
uses: cachix/install-nix-action@v26
with:
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
Expand Down Expand Up @@ -183,7 +183,7 @@ jobs:
stack-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}
stack-2-${{ runner.os }}-ghc-${{ env.ghc_version }}
- uses: haskell-actions/setup@v2.6.1
- uses: haskell-actions/setup@v2.7
id: setup-haskell-stack
with:
ghc-version: ${{ env.ghc_version }}
Expand All @@ -207,7 +207,7 @@ jobs:
needs: formatting
runs-on: ubuntu-22.04
env:
hlint_version: "3.5"
hlint_version: "3.6.1"
steps:
- uses: actions/checkout@v4
with:
Expand Down
5 changes: 3 additions & 2 deletions .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- ignore: {name: "Replace case with maybe"}
- ignore: {name: "Hoist not"}
- ignore: {name: "Redundant bracket"}
- ignore: {name: "Fuse foldr/fmap"}

# Ignore suggestions to reduce duplication, because:
# - High rate of false positives
Expand All @@ -50,8 +51,8 @@
- ignore: {name: Redundant lambda}

# Testing class laws
- ignore: {name: Functor law, within: [Test.Data.Sup, Test.ListT]}
- ignore: {name: Use /=, within: [Test.Data.Sup]}
- ignore: {name: "Functor law", within: [Test.Data.Sup, Test.ListT]}
- ignore: {name: "Use /=", within: [Test.Data.Sup]}
- ignore: {name: "Alternative law, left identity", within: [Test.ListT]}
- ignore: {name: "Alternative law, right identity", within: [Test.ListT]}
- ignore: {name: "Monad law, right identity", within: [Test.ListT]}
Expand Down
16 changes: 0 additions & 16 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
inputs = {
rv-utils.url = "github:runtimeverification/rv-nix-tools";
nixpkgs.follows = "rv-utils/nixpkgs";
nixpkgs2305.url = "nixpkgs/nixos-23.05";
stacklock2nix.url = "github:cdepillabout/stacklock2nix";
z3 = {
url = "github:Z3Prover/z3/z3-4.12.1";
flake = false;
};
};
outputs = { self, nixpkgs, nixpkgs2305, stacklock2nix, z3, rv-utils }:
outputs = { self, nixpkgs, stacklock2nix, z3, rv-utils }:
let
perSystem = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
nixpkgsCleanFor = system: import nixpkgs { inherit system; };
Expand Down Expand Up @@ -201,8 +200,7 @@
additionalDevShellNativeBuildInputs = stacklockHaskellPkgSet:
with ghcVersion final; [
cabal-install
# fourmolu
(import nixpkgs2305 { inherit (prev) system; }).haskellPackages.fourmolu_0_12_0_0
fourmolu
hlint
stacklockHaskellPkgSet.haskell-language-server
final.haskell-language-server
Expand Down Expand Up @@ -239,9 +237,9 @@
mkShell {
nativeBuildInputs = [
(haskell.lib.justStaticExecutables
# (ghcVersion pkgs).fourmolu
(import nixpkgs2305 { inherit system; }).haskellPackages.fourmolu_0_12_0_0
)
(ghcVersion pkgs).fourmolu)
(haskell.lib.justStaticExecutables
(ghcVersion pkgs).hlint)
];
};
cabal = let pkgs = nixpkgsFor system;
Expand Down
15 changes: 15 additions & 0 deletions fourmolu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,18 @@ column-limit: 100

# whether to put parentheses around single constraints (`auto` would keep existing ones)
single-constraint-parens: never

reexports:
- module Prelude.Kore exports Prelude
- module Prelude.Kore exports Data.Foldable
- module Prelude.Kore exports Data.Traversable
- module Prelude.Kore exports Control.Comonad
- module Kore.Pretty exports Prettyprinter

fixities:
- infixr 7 <>
- infixr 6 <+>
- infixl 4 <$>, <*>, <*, *>, <**>
- infixl 3 <|>
- infixl 1 &, >>=, >>, <&>
- infixr 0 $
5 changes: 2 additions & 3 deletions kore/src/Kore/Exec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,8 @@ matchDisjunction ::
matchDisjunction mainModule matchPattern disjunctionPattern =
evalSimplifierProofs mainModule $ do
results <-
traverse (runMaybeT . match matchPattern) disjunctionPattern
<&> catMaybes
<&> concatMap toList
concatMap toList . catMaybes
<$> traverse (runMaybeT . match matchPattern) disjunctionPattern
results
<&> Condition.toPredicate
& Predicate.makeMultipleOrPredicate
Expand Down
14 changes: 7 additions & 7 deletions kore/src/Kore/Exec/GraphTraversal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,13 @@ graphTraversal
filter isStop collected
pure $
if
| (not $ null stuck) ->
GotStuck 0 (mapMaybe extractStuckOrVacuous stuck)
| not $ null unproven ->
Stopped
(mapMaybe extractState unproven)
(concatMap extractNext unproven)
| otherwise -> fmap currentState result
| (not $ null stuck) ->
GotStuck 0 (mapMaybe extractStuckOrVacuous stuck)
| not $ null unproven ->
Stopped
(mapMaybe extractState unproven)
(concatMap extractNext unproven)
| otherwise -> fmap currentState result
other -> pure $ fmap currentState other

{- | Used to select whether the step should be canceled
Expand Down
4 changes: 1 addition & 3 deletions kore/test/Test/Kore/Syntax/Json/Roundtrips.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ patternsFrom path = do

getPatterns :: ParsedDefinition -> [ParsedPattern]
getPatterns =
mapMaybe fromSentence
. concatMap Kore.moduleSentences
. Kore.definitionModules
concatMap (mapMaybe fromSentence . Kore.moduleSentences) . Kore.definitionModules

fromSentence :: Kore.Sentence ParsedPattern -> Maybe ParsedPattern
fromSentence (Kore.SentenceAliasSentence alias) =
Expand Down

0 comments on commit 847aad9

Please sign in to comment.