1
1
mirror of https://github.com/github/semantic.git synced 2024-12-27 17:05:33 +03:00

Use withModules to define evaluates.

This commit is contained in:
Rob Rix 2018-03-02 12:26:46 -05:00
parent 111e31e4da
commit 529becae3f

View File

@ -57,8 +57,7 @@ evaluates :: forall v term
=> [(Blob, term)] -- List of (blob, term) pairs that make up the program to be evaluated => [(Blob, term)] -- List of (blob, term) pairs that make up the program to be evaluated
-> (Blob, term) -- Entrypoint -> (Blob, term) -- Entrypoint
-> Final (EvaluationEffects term v) v -> Final (EvaluationEffects term v) v
evaluates pairs (_, t) = run @(EvaluationEffects term v) (runEvaluator (runEvaluation (localModuleTable (const moduleTable) (evaluateTerm t)))) evaluates pairs (_, t) = run @(EvaluationEffects term v) (runEvaluator (runEvaluation (withModules pairs (evaluateTerm t))))
where moduleTable = Linker (Map.fromList (map (first (dropExtensions . blobPath)) pairs))
withModules :: (MonadAnalysis term value m, MonadEvaluator term value m) => [(Blob, term)] -> m a -> m a withModules :: (MonadAnalysis term value m, MonadEvaluator term value m) => [(Blob, term)] -> m a -> m a
withModules pairs = localModuleTable (const moduleTable) withModules pairs = localModuleTable (const moduleTable)