From f0f9751afee852ce65a3fc509c9f581be9a82201 Mon Sep 17 00:00:00 2001 From: justin Date: Sat, 23 Jul 2022 19:17:03 +0100 Subject: [PATCH] Hlint cleanup --- src/Dodge/Corpse/Draw.hs | 2 +- src/Dodge/Creature/ArmourChase.hs | 1 - src/Dodge/Creature/Test.hs | 2 +- src/Dodge/Item/Weapon/TriggerType.hs | 2 +- src/Dodge/Layout.hs | 4 ++-- src/Dodge/Render/ShapePicture.hs | 2 +- src/Dodge/Update/Camera.hs | 2 +- src/Dodge/WorldEvent/ThingsHit.hs | 2 +- src/Dodge/Zoning/Base.hs | 4 ++-- src/Dodge/Zoning/Creature.hs | 2 +- 10 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Dodge/Corpse/Draw.hs b/src/Dodge/Corpse/Draw.hs index e9382ecbd..a19c93dcf 100644 --- a/src/Dodge/Corpse/Draw.hs +++ b/src/Dodge/Corpse/Draw.hs @@ -4,4 +4,4 @@ import ShapePicture -- not currently used, too simple drawCorpse :: Corpse -> SPic -drawCorpse cp = _cpSPic cp +drawCorpse = _cpSPic diff --git a/src/Dodge/Creature/ArmourChase.hs b/src/Dodge/Creature/ArmourChase.hs index b1aff361d..c88dd55e5 100644 --- a/src/Dodge/Creature/ArmourChase.hs +++ b/src/Dodge/Creature/ArmourChase.hs @@ -43,4 +43,3 @@ armourChaseCrit = chaseCrit } & crEquipment . at OnChest ?~ 0 & crInvEquipped . at 0 ?~ OnChest - where diff --git a/src/Dodge/Creature/Test.hs b/src/Dodge/Creature/Test.hs index 8b585a403..5673c7549 100644 --- a/src/Dodge/Creature/Test.hs +++ b/src/Dodge/Creature/Test.hs @@ -64,7 +64,7 @@ crSafeDistFromTarg d cr = case cr ^? crIntention . targetCr . _Just of Nothing -> True crStratConMatches :: Strategy -> Creature -> Bool -crStratConMatches strat cr = strat == (_apStrategy $ _crActionPlan cr) +crStratConMatches strat cr = strat == _apStrategy (_crActionPlan cr) -- this equality check might be slow... crAwayFromPost :: Creature -> Bool diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index 6eb5da6e2..cd69a4c51 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TupleSections #-} +--{-# LANGUAGE TupleSections #-} {- | Weapon effects when pulling the trigger. -} module Dodge.Item.Weapon.TriggerType diff --git a/src/Dodge/Layout.hs b/src/Dodge/Layout.hs index 0e1e30ef7..0d5e4169b 100644 --- a/src/Dodge/Layout.hs +++ b/src/Dodge/Layout.hs @@ -45,8 +45,8 @@ generateLevelFromRoomList gr' w = initWallZoning , _gameRooms = gameRoomsFromRooms (IM.elems rs') , _pathGraph = path } - & pnZoning .~ foldl' (flip $ zonePn) mempty (labNodes path) - & peZoning .~ foldl' (flip $ zonePe) mempty (labEdges path) + & pnZoning .~ foldl' (flip zonePn) mempty (labNodes path) + & peZoning .~ foldl' (flip zonePe) mempty (labEdges path) where (_,path) = pairsToGraph pairPath' pairPath = foldMap _rmPath rs diff --git a/src/Dodge/Render/ShapePicture.hs b/src/Dodge/Render/ShapePicture.hs index 739fd987b..0387cd40f 100644 --- a/src/Dodge/Render/ShapePicture.hs +++ b/src/Dodge/Render/ShapePicture.hs @@ -284,7 +284,7 @@ innerSquare :: [Point2] innerSquare = [V2 1 1, V2 (-1) 1, V2 (-1) (-1), V2 1 (-1)] drawWallSearchRays :: World -> Picture -drawWallSearchRays w = foldMap f $ map fst $ allVisibleWalls w +drawWallSearchRays w = foldMap (f . fst) $ allVisibleWalls w where f p = setLayer DebugLayer $ color yellow $ uncurryV translate p (circle 5) <> line [_cameraViewFrom w, p] diff --git a/src/Dodge/Update/Camera.hs b/src/Dodge/Update/Camera.hs index 7b3e812c7..bbc7624cd 100644 --- a/src/Dodge/Update/Camera.hs +++ b/src/Dodge/Update/Camera.hs @@ -35,7 +35,7 @@ updateCamera :: Universe -> Universe updateCamera uv = uv & over uvWorld (setViewDistance cfig ) & moveZoomCamera - & over uvWorld (updateScopeZoom ) + & over uvWorld updateScopeZoom & over uvWorld (rotateCamera cfig ) where cfig = _uvConfig uv diff --git a/src/Dodge/WorldEvent/ThingsHit.hs b/src/Dodge/WorldEvent/ThingsHit.hs index 9cef6b76b..a08e5cd0a 100644 --- a/src/Dodge/WorldEvent/ThingsHit.hs +++ b/src/Dodge/WorldEvent/ThingsHit.hs @@ -55,7 +55,7 @@ crsHit sp ep w thingHitFilt :: (Creature -> Bool) -> (Wall -> Bool) -> Point2 -> Point2 -> World -> Maybe (Point2, Either Creature Wall) -thingHitFilt fcr fwl sp ep = listToMaybe . filter (f . snd) . thingsHit sp ep +thingHitFilt fcr fwl sp ep = List.find (f . snd) . thingsHit sp ep where f (Left cr) = fcr cr f (Right wl) = fwl wl diff --git a/src/Dodge/Zoning/Base.hs b/src/Dodge/Zoning/Base.hs index 2242bd2c8..1f80429c0 100644 --- a/src/Dodge/Zoning/Base.hs +++ b/src/Dodge/Zoning/Base.hs @@ -23,7 +23,7 @@ makeIntInterval x y makeInt2Interval :: Int2 -> Int2 -> [Int2] makeInt2Interval (V2 x1 y1) (V2 x2 y2) - = [(V2 x y) | x <- makeIntInterval x1 x2, y <- makeIntInterval y1 y2] + = [V2 x y | x <- makeIntInterval x1 x2, y <- makeIntInterval y1 y2] zoneOfPoint' :: Float -> Point2 -> Int2 zoneOfPoint' s = fmap (divTo s) @@ -35,7 +35,7 @@ zoneExtract :: Monoid m => Int2 -> IM.IntMap (IM.IntMap m) -> m zoneExtract (V2 x y) = fromMaybe mempty . (^? ix x . ix y) -- zonesExtract :: Monoid m => IM.IntMap (IM.IntMap m) -> [Int2] -> m -zonesExtract im = foldMap (flip zoneExtract im) +zonesExtract im = foldMap (`zoneExtract` im) xIntercepts' :: Float -> Point2 -> Point2 -> [Point2] {-# INLINE xIntercepts' #-} diff --git a/src/Dodge/Zoning/Creature.hs b/src/Dodge/Zoning/Creature.hs index eb1eab8c0..b1aafa38c 100644 --- a/src/Dodge/Zoning/Creature.hs +++ b/src/Dodge/Zoning/Creature.hs @@ -36,7 +36,7 @@ zoneOfCr :: Creature -> [Int2] zoneOfCr cr = zoneOfCirc crZoneSize (_crPos cr) (_crRad cr) minCrIXOn :: Ord a => (Creature -> a) -> IS.IntSet -> World -> Maybe Creature -minCrIXOn f is w = fmap fst $ IS.foldl' g Nothing is +minCrIXOn f is w = fst <$> IS.foldl' g Nothing is where g mcrx cid = minOn snd <$> getpair cid <*> mcrx getpair cid = fmap h $ w ^? creatures . ix cid