mirror of
https://github.com/github/semantic.git
synced 2024-12-21 05:41:54 +03:00
Extract evaluateEntryPoint to the top level.
This commit is contained in:
parent
6069c95d1d
commit
0aa506fae5
@ -348,11 +348,22 @@ evaluatePackageBody :: ( inner ~ (Reader (ModuleTable [Module term]) ': effects)
|
||||
evaluatePackageBody body
|
||||
= withUnevaluatedModules (packageModules body)
|
||||
. withPrelude (packagePrelude body)
|
||||
$ traverse evaluateEntryPoint (ModuleTable.toPairs (packageEntryPoints body))
|
||||
where
|
||||
evaluateEntryPoint (m, sym) = do
|
||||
v <- maybe unit (pure . snd) <$> requireWith evalModule m
|
||||
maybe v ((`call` []) <=< variable) sym
|
||||
$ traverse (uncurry evaluateEntryPoint) (ModuleTable.toPairs (packageEntryPoints body))
|
||||
|
||||
evaluateEntryPoint :: ( Evaluatable (Base term)
|
||||
, Member (EvalModule term value) effects
|
||||
, Member Fail effects
|
||||
, Member (Reader PackageInfo) effects
|
||||
, MonadAnalysis location term value effects m
|
||||
, MonadEvaluatable location term value effects m
|
||||
, Recursive term
|
||||
)
|
||||
=> ModulePath
|
||||
-> Maybe Name
|
||||
-> m effects value
|
||||
evaluateEntryPoint m sym = do
|
||||
v <- maybe unit (pure . snd) <$> requireWith evalModule m
|
||||
maybe v ((`call` []) <=< variable) sym
|
||||
|
||||
withPrelude :: ( Evaluatable (Base term)
|
||||
, Member (EvalModule term value) effects
|
||||
|
Loading…
Reference in New Issue
Block a user