1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00

Define MonadGC.

This commit is contained in:
Rob Rix 2018-03-12 14:35:57 -04:00
parent 8d1b80e599
commit d39c5758b9

View File

@ -4,6 +4,8 @@ module Analysis.Abstract.Collecting
) where
import Control.Abstract.Analysis
import Data.Abstract.Live
import Data.Abstract.Value
import Prologue
newtype Collecting m term value (effects :: [* -> *]) a = Collecting (m term value effects a)
@ -18,3 +20,12 @@ instance ( MonadAnalysis term value (m term value effects)
type RequiredEffects term value (Collecting m term value effects) = RequiredEffects term value (m term value effects)
analyzeTerm term = liftAnalyze analyzeTerm term
-- | 'Monad's offering a local set of 'Live' (rooted/reachable) addresses.
class Monad m => MonadGC value m where
-- | Retrieve the local 'Live' set.
askRoots :: m (Live (LocationFor value) value)
-- | Run a computation with the given 'Live' set added to the local root set.
extraRoots :: Live (LocationFor value) value -> m a -> m a