mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
liftAnalyze takes the algebra to lift.
This commit is contained in:
parent
ff6f99fbf5
commit
4f085d6707
@ -140,7 +140,7 @@ memoizeEval e = do
|
||||
Nothing -> do
|
||||
pairs <- asksCache (fromMaybe mempty . cacheLookup c)
|
||||
modifyCache (cacheSet c pairs)
|
||||
v <- liftAnalyze e
|
||||
v <- liftAnalyze analyzeTerm e
|
||||
store' <- getStore
|
||||
modifyCache (cacheInsert c (v, store'))
|
||||
pure v
|
||||
|
@ -72,4 +72,4 @@ instance ( Corecursive (TermFor m)
|
||||
=> MonadAnalysis (DeadCodeAnalysis m) where
|
||||
analyzeTerm term = do
|
||||
revive (embedSubterm term)
|
||||
liftAnalyze term
|
||||
liftAnalyze analyzeTerm term
|
||||
|
@ -36,7 +36,7 @@ instance ( Corecursive (TermFor m)
|
||||
analyzeTerm term = do
|
||||
config <- getConfiguration (embedSubterm term)
|
||||
trace (Reducer.unit config)
|
||||
liftAnalyze term
|
||||
liftAnalyze analyzeTerm term
|
||||
|
||||
trace :: ( Effectful m
|
||||
, Member (TracerFor trace m) (Effects m)
|
||||
|
@ -41,10 +41,10 @@ liftAnalyze :: ( term ~ TermFor m
|
||||
, Coercible (m value) (t m value)
|
||||
, Coercible (t m value) (m value)
|
||||
, Functor (Base term)
|
||||
, MonadAnalysis m
|
||||
)
|
||||
=> SubtermAlgebra (Base term) term (t m value)
|
||||
liftAnalyze term = pack1 (analyzeTerm (second unpack1 <$> term))
|
||||
=> SubtermAlgebra (Base term) term (m value)
|
||||
-> SubtermAlgebra (Base term) term (t m value)
|
||||
liftAnalyze analyze term = pack1 (analyze (second unpack1 <$> term))
|
||||
where pack1 = coerce
|
||||
unpack1 :: Coercible (t m value) (m value) => t m value -> m value
|
||||
unpack1 = coerce
|
||||
|
Loading…
Reference in New Issue
Block a user