diff --git a/src/Actions.hs b/src/Actions.hs index 3fcf04a8d..3d1660711 100644 --- a/src/Actions.hs +++ b/src/Actions.hs @@ -490,9 +490,11 @@ search = do Level { lmap = lmap } <- gets slevel Movable { mloc = ploc } <- gets splayer - let searchTile (Tile (Door hv (Just n)) x,t') = Just (Tile (Door hv (Just (max (n - 1) 0))) x, t') - searchTile t = Just t - slmap = foldl (\ l m -> update searchTile (shift ploc m) l) lmap moves + let searchTile (Tile (Door hv (Just n)) x, t') = + (Tile (Door hv (Just (max (n - 1) 0))) x, t') + searchTile t = t + f l m = M.adjust searchTile (shift ploc m) l + slmap = foldl' f lmap moves modify (updateLevel (updateLMap (const slmap))) -- | Start the floor targeting mode or toggle between the two floor modes. diff --git a/src/Item.hs b/src/Item.hs index 63cbff8fb..aef275e51 100644 --- a/src/Item.hs +++ b/src/Item.hs @@ -245,7 +245,7 @@ strongestSword :: [Item] -> Int strongestSword l = let aux acc (Item { itype = Sword i }) = max acc i aux acc _ = acc - in foldl aux 0 l + in foldl' aux 0 l makeObject :: Int -> (String -> String) -> String -> String makeObject 1 adj obj = let b = adj obj diff --git a/src/LambdaHack.hs b/src/LambdaHack.hs index 0dcbaeb1b..d31ca53cc 100644 --- a/src/LambdaHack.hs +++ b/src/LambdaHack.hs @@ -2,6 +2,7 @@ module Main where import System.Directory import Control.Monad +import Data.List as L import Data.Map as M import Action @@ -79,5 +80,5 @@ generate config session msg = defState = defaultState player dng lvl state = defState { sassocs = assocs, sconfig = config } k = Config.get config "heroes" "extraHeroes" - hstate = foldl (addHero hp) state [1..k] + hstate = foldl' (addHero hp) state [1..k] handlerToIO session hstate msg handle diff --git a/src/Level.hs b/src/Level.hs index c48025abc..044f35acb 100644 --- a/src/Level.hs +++ b/src/Level.hs @@ -559,7 +559,7 @@ viewSmell n = let k | n > 9 = '*' -- Scatter randomly or not? scatterItems :: [Item] -> Loc -> Level -> Level scatterItems items loc lvl@(Level { lmap = lmap }) = - let joinItems items = foldl (\ acc i -> snd (joinItem i acc)) items + let joinItems items = foldl' (\ acc i -> snd (joinItem i acc)) items t = lmap `at` loc nt = t { titems = joinItems items (titems t) } ntRemember = lmap `rememberAt` loc