Reformat codebase with Fourmolu (#370)

Run
```bash
fourmolu -i $(find . -name '*.hs')
```
This commit is contained in:
Ondřej Šebek 2022-06-09 00:32:12 +02:00 committed by GitHub
parent 128a15ebe8
commit 9a72bc52a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 18 deletions

View File

@ -15,7 +15,7 @@ import Linear.V2 (V2 (V2))
import Swarm.Game.CESK (emptyStore, initMachine)
import Swarm.Game.Display (defaultRobotDisplay)
import Swarm.Game.Robot (URobot, mkRobot)
import Swarm.Game.State (GameState, addURobot, creativeMode, classicGame0, world)
import Swarm.Game.State (GameState, addURobot, classicGame0, creativeMode, world)
import Swarm.Game.Step (gameTick)
import Swarm.Game.Terrain (TerrainType (DirtT))
import Swarm.Game.World (newWorld)
@ -78,7 +78,7 @@ initRobot prog loc = mkRobot (F.Const ()) Nothing "" [] north loc defaultRobotDi
-- in a row starting at (0,0) and spreading east.
mkGameState :: (V2 Int64 -> URobot) -> Int -> IO GameState
mkGameState robotMaker numRobots = do
let robots = [robotMaker (V2 (fromIntegral x) 0) | x <- [0 .. numRobots -1]]
let robots = [robotMaker (V2 (fromIntegral x) 0) | x <- [0 .. numRobots - 1]]
Right initState <- runExceptT classicGame0
execStateT
(mapM addURobot robots)

View File

@ -12,14 +12,14 @@ chars = "<^>vT~@░ "
replace :: Char -> IO Char
replace ' ' = pick $ zip (replicate 8 0.005 ++ [1]) chars
replace _ = pick $ zip (replicate 4 0.2 ++ replicate 4 0.04 ++ [1]) chars
replace _ = pick $ zip (replicate 4 0.2 ++ replicate 4 0.04 ++ [1]) chars
pick :: [(Double, a)] -> IO a
pick es = do
r <- randomRIO (0 :: Double, 1)
return $ go r es
where
go _ [(_,a)] = a
go r ((p,a):es)
| r < p = a
| otherwise = go (r - p) es
where
go _ [(_, a)] = a
go r ((p, a) : es)
| r < p = a
| otherwise = go (r - p) es

View File

@ -180,7 +180,7 @@ mkWorldFun pwd = E $ \em -> do
Coords (ulr, ulc) = locToCoords (ul wd)
arr <-
fmap (listArray ((ulr, ulc), (ulr + rs -1, ulc + cs -1)))
fmap (listArray ((ulr, ulc), (ulr + rs - 1, ulc + cs - 1)))
. mapM toEntity
. concat
$ grid

View File

@ -370,8 +370,8 @@ viewingRegion :: GameState -> (Int64, Int64) -> (W.Coords, W.Coords)
viewingRegion g (w, h) = (W.Coords (rmin, cmin), W.Coords (rmax, cmax))
where
V2 cx cy = g ^. viewCenter
(rmin, rmax) = over both (+ (- cy - h `div` 2)) (0, h -1)
(cmin, cmax) = over both (+ (cx - w `div` 2)) (0, w -1)
(rmin, rmax) = over both (+ (- cy - h `div` 2)) (0, h - 1)
(cmin, cmax) = over both (+ (cx - w `div` 2)) (0, w - 1)
-- | Find out which robot is currently specified by the
-- 'viewCenterRule', if any.

View File

@ -615,8 +615,8 @@ drawRecipe e inv (Recipe ins outs reqs time) =
, fmtEntityName missing ingr -- name of the input
, padLeft (Pad 1) $ -- a connecting line: ─────┬
hBorder
<+> ( joinableBorder (Edges (i /= 0) (i /= inLen -1) True False) -- ...maybe plus vert ext: │
<=> if i /= inLen -1
<+> ( joinableBorder (Edges (i /= 0) (i /= inLen - 1) True False) -- ...maybe plus vert ext: │
<=> if i /= inLen - 1
then vLimit (subtract 1 . length . T.words $ ingr ^. entityName) vBorder
else emptyWidget
)
@ -627,8 +627,8 @@ drawRecipe e inv (Recipe ins outs reqs time) =
drawOut i (n, ingr) =
hBox
[ padRight (Pad 1) $
( joinableBorder (Edges (i /= 0) (i /= outLen -1) False True)
<=> if i /= outLen -1
( joinableBorder (Edges (i /= 0) (i /= outLen - 1) False True)
<=> if i /= outLen - 1
then vLimit (subtract 1 . length . T.words $ ingr ^. entityName) vBorder
else emptyWidget
)
@ -676,7 +676,7 @@ drawRobotLog s =
allMe = all ((== rn) . Just . view leRobotName) logEntries
drawEntry i e =
(if i == n -1 && s ^. uiState . uiScrollToEnd then visible else id)
(if i == n - 1 && s ^. uiState . uiScrollToEnd then visible else id)
. txtWrapWith indent2
$ (if allMe then e ^. leText else T.concat ["[", e ^. leRobotName, "] ", e ^. leText])

View File

@ -79,7 +79,7 @@ class FromJSONE e a where
parseJSONE = liftE . parseJSON
parseJSONE' :: e -> Value -> Parser a
parseJSONE' e = ($e) . runE . parseJSONE
parseJSONE' e = ($ e) . runE . parseJSONE
instance FromJSONE e Int

View File

@ -14,8 +14,8 @@ import Test.Tasty
import Test.Tasty.HUnit
import Witch
import Swarm.Game.Scenario
import Swarm.Game.Entity
import Swarm.Game.Scenario
import Swarm.Language.Pipeline (processTerm)
import Swarm.Util.Yaml (decodeFileEitherE)