1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

📝 storeRestrict.

This commit is contained in:
Rob Rix 2017-12-20 17:21:55 -05:00
parent 6ba82ee2da
commit 38f1f59125

View File

@ -40,5 +40,6 @@ storeInsert (Address address) value = Store . Map.insertWith (<>) address (point
storeSize :: Store l a -> Int
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 (Store m) roots = Store (Map.filterWithKey (\ address _ -> Address address `liveMember` roots) m)