From 32b4adae9b7292175eb00c12ceba1106c0c68d69 Mon Sep 17 00:00:00 2001 From: Karl Ostmo Date: Fri, 9 Jun 2023 16:05:32 -0700 Subject: [PATCH 1/4] fix 'single-constraint-parens' config value --- CONTRIBUTING.md | 2 +- fourmolu.yaml | 2 +- scripts/reformat-code.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 655ad8e98..3bb8165b4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -241,7 +241,7 @@ ghcup set ghc 9.4.5 You can run the formatter from the shell: ```bash cd path/to/the/root/of/swarm/repo -find src/ app/ test/ -name "*.hs" | xargs fourmolu --mode=inplace +fourmolu --mode=inplace src app test ``` For convenience, one may alternatively execute this script: diff --git a/fourmolu.yaml b/fourmolu.yaml index 787a2ddf6..65c20f61b 100644 --- a/fourmolu.yaml +++ b/fourmolu.yaml @@ -5,6 +5,6 @@ indent-wheres: false # 'false' means save space by only half-indenting the 'wher diff-friendly-import-export: true let-style: inline respectful: true -single-constraint-parens: false +single-constraint-parens: auto haddock-style: single-line newlines-between-decls: 1 diff --git a/scripts/reformat-code.sh b/scripts/reformat-code.sh index 2bd939e8e..e6ad9e905 100755 --- a/scripts/reformat-code.sh +++ b/scripts/reformat-code.sh @@ -3,4 +3,4 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) cd $SCRIPT_DIR/.. -find src/ app/ test/ -name "*.hs" | xargs fourmolu --mode=inplace \ No newline at end of file +fourmolu --mode=inplace src app test \ No newline at end of file From c411cabfcfa36c46aa839940c48f1b5d44e400a8 Mon Sep 17 00:00:00 2001 From: Karl Ostmo Date: Fri, 9 Jun 2023 16:15:55 -0700 Subject: [PATCH 2/4] apply fourmolu v12 formatting --- src/Swarm/TUI/View/CellDisplay.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Swarm/TUI/View/CellDisplay.hs b/src/Swarm/TUI/View/CellDisplay.hs index 36b3712a4..ff770c745 100644 --- a/src/Swarm/TUI/View/CellDisplay.hs +++ b/src/Swarm/TUI/View/CellDisplay.hs @@ -72,7 +72,7 @@ displayEntityCell worldEditor g coords = e `hasProperty` Known || (e ^. entityName) - `elem` (g ^. knownEntities) + `elem` (g ^. knownEntities) || case hidingMode g of HideAllEntities -> False HideNoEntity -> True From b3b97a5a094472f138bea416d3e6853e8f51745f Mon Sep 17 00:00:00 2001 From: Brent Yorgey Date: Wed, 12 Jul 2023 07:27:35 -0500 Subject: [PATCH 3/4] more fourmolu-0.12 changes --- src/Swarm/Game/Scenario/Topography/Cell.hs | 2 +- src/Swarm/Game/Scenario/Topography/Structure.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Swarm/Game/Scenario/Topography/Cell.hs b/src/Swarm/Game/Scenario/Topography/Cell.hs index 583b1f7a1..7de1cc25a 100644 --- a/src/Swarm/Game/Scenario/Topography/Cell.hs +++ b/src/Swarm/Game/Scenario/Topography/Cell.hs @@ -97,7 +97,7 @@ instance FromJSONE (EntityMap, RobotMap) (AugmentedCell Entity) where AugmentedCell <$> liftE (v .:? "waypoint") <*> v - ..: "cell" + ..: "cell" ------------------------------------------------------------ -- World editor diff --git a/src/Swarm/Game/Scenario/Topography/Structure.hs b/src/Swarm/Game/Scenario/Topography/Structure.hs index da2bac566..c1b8c3e47 100644 --- a/src/Swarm/Game/Scenario/Topography/Structure.hs +++ b/src/Swarm/Game/Scenario/Topography/Structure.hs @@ -36,7 +36,7 @@ instance FromJSONE (EntityMap, RobotMap) (NamedStructure (Maybe (PCell Entity))) sName <- liftE $ v .: "name" NamedStructure sName <$> v - ..: "structure" + ..: "structure" data PStructure c = Structure { area :: [[c]] From 62ce7b2ba909e854ffde6ad9d70daee99ecb06a5 Mon Sep 17 00:00:00 2001 From: Brent Yorgey Date: Wed, 12 Jul 2023 07:44:56 -0500 Subject: [PATCH 4/4] update to `fourmolu-0.13` --- .restyled.yaml | 2 +- CONTRIBUTING.md | 4 ++-- fourmolu.yaml | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.restyled.yaml b/.restyled.yaml index 5b29b298c..51ac9fa3d 100644 --- a/.restyled.yaml +++ b/.restyled.yaml @@ -1,6 +1,6 @@ restylers_version: stable restylers: - fourmolu: - image: 'restyled/restyler-fourmolu:v0.10.1.0' + image: 'restyled/restyler-fourmolu:v0.13.0.0' arguments: [] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3bb8165b4..8ff29626d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -216,7 +216,7 @@ them! #### Formatting style -We use [`fourmolu-0.10.1.0`](https://hackage.haskell.org/package/fourmolu) +We use [`fourmolu-0.13.0.0`](https://hackage.haskell.org/package/fourmolu) with a [custom configuration](https://github.com/swarm-game/swarm/blob/main/fourmolu.yaml) for formatting Haskell code. @@ -224,7 +224,7 @@ for formatting Haskell code. To install the formatter, run: ```bash -cabal install fourmolu-0.10.1.0 +cabal install fourmolu-0.13.0.0 ``` If this installation does not work, you may have to set your GHC to a version supported by `fourmolu`: diff --git a/fourmolu.yaml b/fourmolu.yaml index 65c20f61b..56d9ce84a 100644 --- a/fourmolu.yaml +++ b/fourmolu.yaml @@ -8,3 +8,6 @@ respectful: true single-constraint-parens: auto haddock-style: single-line newlines-between-decls: 1 +reexports: + - module Text.Megaparsec exports Control.Applicative + - module Options.Applicative exports Control.Applicative