Fix thunk leak
This commit is contained in:
+6
-4
@@ -24,7 +24,7 @@ import Data.List
|
|||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.Function
|
import Data.Function
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
import qualified Data.IntMap.Lazy as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
import System.Random
|
import System.Random
|
||||||
@@ -184,7 +184,9 @@ updateSeenWalls w = foldl' markWallSeen w wallsToUpdate
|
|||||||
$ nRays 20
|
$ nRays 20
|
||||||
|
|
||||||
markWallSeen :: World -> Wall -> World
|
markWallSeen :: World -> Wall -> World
|
||||||
markWallSeen w wl = w & walls . ix (_wlID wl) . wlSeen .~ True
|
markWallSeen w wl = w { _walls = IM.adjust mw (_wlID wl) $ _walls w }
|
||||||
|
where
|
||||||
|
mw wl' = wl' {_wlSeen = True}
|
||||||
|
|
||||||
--setTestStringIO :: IO World -> IO World
|
--setTestStringIO :: IO World -> IO World
|
||||||
--setTestStringIO = fmap (\ w -> set testString (show $ s w) w)
|
--setTestStringIO = fmap (\ w -> set testString (show $ s w) w)
|
||||||
@@ -310,6 +312,6 @@ visibleWalls p1 p2 ws
|
|||||||
. sortOn (dist p1 . fromJust . fst)
|
. sortOn (dist p1 . fromJust . fst)
|
||||||
. filter ((/=) Nothing . fst)
|
. filter ((/=) Nothing . fst)
|
||||||
. map f
|
. map f
|
||||||
$ IM.toList ws
|
$ IM.elems ws
|
||||||
where
|
where
|
||||||
f (i,wl) = (uncurry intersectSegSeg (_wlLine wl) p1 p2, wl)
|
f wl = (uncurry intersectSegSeg (_wlLine wl) p1 p2, wl)
|
||||||
|
|||||||
Reference in New Issue
Block a user