1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

Split the evaluation of a package body out into a new function.

This commit is contained in:
Rob Rix 2018-04-02 17:30:04 -04:00
parent 9266439e7f
commit 5d6c57312e

View File

@ -186,8 +186,13 @@ evaluatePackage :: ( Effectful m
)
=> Package term
-> m effects [value]
evaluatePackage p = pushOrigin (packageOrigin p) (localModuleTable (<> packageModules (packageBody p))
(traverse evaluateEntryPoint (ModuleTable.toPairs (packageEntryPoints (packageBody p)))))
evaluatePackage p = pushOrigin (packageOrigin p) (evaluatePackageBody (packageBody p))
evaluatePackageBody :: MonadEvaluatable location term value m
=> PackageBody term
-> m [value]
evaluatePackageBody body = localModuleTable (<> packageModules body)
(traverse evaluateEntryPoint (ModuleTable.toPairs (packageEntryPoints body)))
where evaluateEntryPoint (m, sym) = do
(_, v) <- require m
maybe (pure v) ((`call` []) <=< variable) sym