Cleanup
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
module Dodge.Zone.Update where
|
module Dodge.Zone.Update
|
||||||
|
( updateZoning
|
||||||
|
) where
|
||||||
import Dodge.Data.Zoning
|
import Dodge.Data.Zoning
|
||||||
import StreamingHelp
|
import StreamingHelp
|
||||||
import qualified Streaming.Prelude as S
|
import qualified Streaming.Prelude as S
|
||||||
@@ -7,20 +9,11 @@ import Geometry
|
|||||||
import LensHelp
|
import LensHelp
|
||||||
|
|
||||||
updateZoning :: Monoid (t a) => (a -> t a -> t a) -> a -> Zoning t a -> Zoning t a
|
updateZoning :: Monoid (t a) => (a -> t a -> t a) -> a -> Zoning t a -> Zoning t a
|
||||||
|
{-# INLINE updateZoning #-}
|
||||||
updateZoning f obj zn = runIdentity (S.fold_ doinsert zn id (_znFunc zn (_znSize zn) obj))
|
updateZoning f obj zn = runIdentity (S.fold_ doinsert zn id (_znFunc zn (_znSize zn) obj))
|
||||||
where
|
where
|
||||||
doinsert znobs vxy = insertInZoneWith vxy (\_ -> f obj) (f obj mempty) znobs
|
doinsert znobs vxy = insertInZoneWith vxy (\_ -> f obj) (f obj mempty) znobs
|
||||||
|
|
||||||
--alterInZone :: (a -> Maybe (t a) -> Maybe (t a)) -> a -> Zoning
|
|
||||||
|
|
||||||
updateInZoning' :: Applicative t => (t a -> t a -> t a) -> a -> Zoning t a -> Zoning t a
|
|
||||||
updateInZoning' f obj zn = runIdentity (S.fold_ doinsert zn id (_znFunc zn (_znSize zn) obj))
|
|
||||||
where
|
|
||||||
doinsert znobs vxy = insertInZoneWith vxy f (pure obj) znobs
|
|
||||||
|
|
||||||
imInsert :: (a -> Int) -> a -> IM.IntMap a -> IM.IntMap a
|
|
||||||
imInsert getID x = IM.insert (getID x) x
|
|
||||||
|
|
||||||
insertInZoneWith
|
insertInZoneWith
|
||||||
:: Int2
|
:: Int2
|
||||||
-> (t a -> t a -> t a) -- ^ Combining function
|
-> (t a -> t a -> t a) -- ^ Combining function
|
||||||
|
|||||||
Reference in New Issue
Block a user