From aae736ba4c0b64a0409fa0b1e00c2723945f7abe Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 17 Jul 2018 15:20:36 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20compute=20lists=20of=20free=20n?= =?UTF-8?q?ames.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Semantic/Graph.hs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Semantic/Graph.hs b/src/Semantic/Graph.hs index 290d40e11..604d188af 100644 --- a/src/Semantic/Graph.hs +++ b/src/Semantic/Graph.hs @@ -27,7 +27,6 @@ import Analysis.Abstract.Caching import Analysis.Abstract.Collecting import Analysis.Abstract.Graph as Graph import Control.Abstract -import Control.Monad.Effect (reinterpret) import Data.Abstract.Address import Data.Abstract.Evaluatable import Data.Abstract.Module @@ -90,7 +89,7 @@ runCallGraph :: ( HasField ann Span runCallGraph lang includePackages modules package = do let analyzeTerm = withTermSpans . graphingTerms . cachingTerms analyzeModule = (if includePackages then graphingPackages else id) . convergingModules . graphingModules - extractGraph (_, (_, (graph, _))) = simplify graph + extractGraph (_, (graph, _)) = simplify graph runGraphAnalysis = runState (lowerBound @(Heap (Hole (Maybe Name) (Located Monovariant)) All Abstract)) . runFresh 0 @@ -130,7 +129,7 @@ runImportGraph lang (package :: Package term) | [m :| []] <- toList (packageModules package) = vertex m <$ trace ("single module, skipping import graph computation for " <> modulePath (moduleInfo m)) | otherwise = let analyzeModule = graphingModuleInfo - extractGraph (_, (_, (graph, _))) = do + extractGraph (_, (graph, _)) = do info <- graph maybe lowerBound (foldMap vertex) (ModuleTable.lookup (modulePath info) (packageModules package)) runImportGraphAnalysis @@ -250,10 +249,8 @@ resumingValueError = runValueErrorWith (\ err -> trace ("ValueError: " <> pretty KeyValueError{} -> pure (hole, hole) ArithmeticError{} -> pure hole) -resumingEnvironmentError :: (AbstractHole address, Effects effects) => Evaluator address value (Resumable (EnvironmentError address) ': effects) a -> Evaluator address value effects ([Name], a) -resumingEnvironmentError - = runState [] - . reinterpret (\ (Resumable (FreeVariable name)) -> modify' (name :) $> hole) +resumingEnvironmentError :: (AbstractHole address, Effects effects) => Evaluator address value (Resumable (EnvironmentError address) ': effects) a -> Evaluator address value effects a +resumingEnvironmentError = interpret (\ (Resumable (FreeVariable _)) -> pure hole) resumingTypeError :: ( Alternative (m address Type (State TypeMap ': effects)) , Effects effects