mirror of
https://github.com/github/semantic.git
synced 2024-12-21 05:41:54 +03:00
Define MonadGC.
This commit is contained in:
parent
8d1b80e599
commit
d39c5758b9
@ -4,6 +4,8 @@ module Analysis.Abstract.Collecting
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Abstract.Analysis
|
import Control.Abstract.Analysis
|
||||||
|
import Data.Abstract.Live
|
||||||
|
import Data.Abstract.Value
|
||||||
import Prologue
|
import Prologue
|
||||||
|
|
||||||
newtype Collecting m term value (effects :: [* -> *]) a = Collecting (m term value effects a)
|
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)
|
type RequiredEffects term value (Collecting m term value effects) = RequiredEffects term value (m term value effects)
|
||||||
|
|
||||||
analyzeTerm term = liftAnalyze analyzeTerm term
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user