Remove Reader monad from multiple creature ais
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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)]
|
||||
-> World -> Creature -> Creature
|
||||
chainCreatureUpdatesLR ls w cr = foldl' unf cr ls
|
||||
where
|
||||
unf cr' (Left g) = g w cr'
|
||||
unf cr' (Right g) = g cr'
|
||||
Reference in New Issue
Block a user