From 38f1f591255d95ffb0eb300c14999032cced328e Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 20 Dec 2017 17:21:55 -0500 Subject: [PATCH] :memo: storeRestrict. --- src/Data/Abstract/Store.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Data/Abstract/Store.hs b/src/Data/Abstract/Store.hs index 6bfb5ec06..f029cf7bf 100644 --- a/src/Data/Abstract/Store.hs +++ b/src/Data/Abstract/Store.hs @@ -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)