mirror of
https://github.com/github/semantic.git
synced 2025-01-03 04:51:57 +03:00
📝 storeRestrict.
This commit is contained in:
parent
6ba82ee2da
commit
38f1f59125
@ -40,5 +40,6 @@ storeInsert (Address address) value = Store . Map.insertWith (<>) address (point
|
|||||||
storeSize :: Store l a -> Int
|
storeSize :: Store l a -> Int
|
||||||
storeSize = Map.size . unStore
|
storeSize = Map.size . unStore
|
||||||
|
|
||||||
|
-- | Restrict a 'Store' to only those 'Address'es in the given 'Live' set (in essence garbage collecting the rest).
|
||||||
storeRestrict :: Ord l => Store l a -> Live l a -> Store l a
|
storeRestrict :: Ord l => Store l a -> Live l a -> Store l a
|
||||||
storeRestrict (Store m) roots = Store (Map.filterWithKey (\ address _ -> Address address `liveMember` roots) m)
|
storeRestrict (Store m) roots = Store (Map.filterWithKey (\ address _ -> Address address `liveMember` roots) m)
|
||||||
|
Loading…
Reference in New Issue
Block a user