1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

Define subterms using the Reducer instance.

This commit is contained in:
Rob Rix 2018-03-07 12:09:51 -05:00
parent c08b46be04
commit ceb42a0839

View File

@ -5,7 +5,7 @@ import Control.Abstract.Addressable
import Control.Abstract.Evaluator
import Data.Abstract.Evaluatable
import Data.Abstract.Value
import Data.Semigroup.Reducer
import Data.Semigroup.Reducer as Reducer
import Data.Set (delete)
import Prologue
@ -32,7 +32,7 @@ evaluateDead term = run @(DeadCodeEffects term value) . runEvaluator . runDeadCo
killAll (subterms term)
evaluateTerm term
where subterms :: (Ord a, Recursive a, Foldable (Base a)) => a -> Dead a
subterms term = para (foldMap (uncurry ((<>) . point))) term <> point term
subterms term = term `cons` para (foldMap (uncurry cons)) term
-- | A newtype wrapping 'Evaluator' which performs a dead code analysis on evaluation.