1
1
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:
Rob Rix 2018-03-08 11:10:08 -05:00
parent ff6f99fbf5
commit 4f085d6707
4 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -72,4 +72,4 @@ instance ( Corecursive (TermFor m)
=> MonadAnalysis (DeadCodeAnalysis m) where
analyzeTerm term = do
revive (embedSubterm term)
liftAnalyze term
liftAnalyze analyzeTerm term

View File

@ -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)

View File

@ -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