1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 15:35:14 +03:00

Inline evalModule into run.

This commit is contained in:
Rob Rix 2018-06-25 17:53:11 -04:00
parent 6a466c62e6
commit fcb7ae815e

View File

@ -100,17 +100,14 @@ evaluate lang analyzeModule analyzeTerm modules = do
box unit
foldr (run preludeEnv) get modules
where run preludeEnv m rest = do
evaluated <- evalModule preludeEnv m
evaluated <- coerce
(runInModule preludeEnv (moduleInfo m))
(analyzeModule (subtermRef . moduleBody)
(evalTerm <$> m))
-- FIXME: this should be some sort of Monoidal insert à la the Heap to accommodate multiple Go files being part of the same module.
modify' (ModuleTable.insert (modulePath (moduleInfo evaluated)) (evaluated :| []))
modify' (ModuleTable.insert (modulePath (moduleInfo m)) ((evaluated <$ m) :| []))
rest
evalModule preludeEnv m
= fmap (<$ m)
. coerce (runInModule preludeEnv (moduleInfo m))
. analyzeModule (subtermRef . moduleBody)
$ evalTerm <$> m
evalTerm term = Subterm term (foldSubterms (analyzeTerm (TermEvaluator . eval . fmap (second runTermEvaluator))) term >>= TermEvaluator . address)
runInModule preludeEnv info