Skip to content
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

Fourmolu fixup #1326

Merged
merged 4 commits into from
Jul 12, 2023
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .restyled.yaml
Original file line number Diff line number Diff line change
@@ -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:
[]
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ 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.

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`:
Expand All @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion fourmolu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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
reexports:
- module Text.Megaparsec exports Control.Applicative
- module Options.Applicative exports Control.Applicative
2 changes: 1 addition & 1 deletion scripts/reformat-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
fourmolu --mode=inplace src app test
2 changes: 1 addition & 1 deletion src/Swarm/Game/Scenario/Topography/Cell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ instance FromJSONE (EntityMap, RobotMap) (AugmentedCell Entity) where
AugmentedCell
<$> liftE (v .:? "waypoint")
<*> v
..: "cell"
..: "cell"

------------------------------------------------------------
-- World editor
Expand Down
2 changes: 1 addition & 1 deletion src/Swarm/Game/Scenario/Topography/Structure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
2 changes: 1 addition & 1 deletion src/Swarm/TUI/View/CellDisplay.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down