1
1
mirror of https://github.com/github/semantic.git synced 2024-12-27 00:44:57 +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) -- Entrypoint
-> Final (EvaluationEffects term v) v
evaluates pairs (_, t) = run @(EvaluationEffects term v) (runEvaluator (runEvaluation (localModuleTable (const moduleTable) (evaluateTerm t))))
where moduleTable = Linker (Map.fromList (map (first (dropExtensions . blobPath)) pairs))
evaluates pairs (_, t) = run @(EvaluationEffects term v) (runEvaluator (runEvaluation (withModules pairs (evaluateTerm t))))
withModules :: (MonadAnalysis term value m, MonadEvaluator term value m) => [(Blob, term)] -> m a -> m a
withModules pairs = localModuleTable (const moduleTable)