Cleanup creature update slightly, add show instance for impulses

This commit is contained in:
2022-03-26 08:08:16 +00:00
parent ae7fbe29c2
commit 3698a738f3
17 changed files with 158 additions and 198 deletions
+4 -12
View File
@@ -2,18 +2,10 @@ module Dodge.Creature.ChainUpdates where
import Dodge.Data
import Data.Foldable
chainCreatureUpdatesLR'
:: [Either (World -> Creature -> Creature) (Creature -> Creature)]
-> World -> Creature -> Creature
chainCreatureUpdatesLR' ls w cr = foldr unf cr ls
where
unf (Left g) = g w
unf (Right g) = g
chainCreatureUpdatesLR
:: [Either (World -> Creature -> Creature) (Creature -> Creature)]
chainCreatureUpdates
:: [World -> Creature -> Creature]
-> World -> Creature -> Creature
chainCreatureUpdatesLR ls w cr = foldl' unf cr ls
chainCreatureUpdates ls w cr = foldl' unf cr ls
where
unf cr' (Left g) = g w cr'
unf cr' (Right g) = g cr'
unf cr' g = g w cr'