Replace some foldr with foldl'

This commit is contained in:
2022-08-23 15:40:15 +01:00
parent 12ce2365c2
commit 9f00e67298
11 changed files with 35 additions and 30 deletions
+2 -1
View File
@@ -2,6 +2,7 @@ module Dodge.Creature.YourControl (
yourControl,
) where
import Data.Foldable
import qualified Data.Map.Strict as M
import Dodge.Base.Coordinate
import Dodge.Creature.Impulse.Movement
@@ -72,7 +73,7 @@ wasdM scancode = case scancode of
_ -> V2 0 0
wasdDir :: World -> Point2
wasdDir = foldr ((+.+) . wasdM) (V2 0 0) . _keys
wasdDir = foldl' (flip $ (+.+) . wasdM) (V2 0 0) . _keys
-- | Set posture according to mouse presses.
mouseActionsCr :: M.Map SDL.MouseButton Bool -> Creature -> Creature