mirror of
https://github.com/github/semantic.git
synced 2024-12-20 21:31:48 +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
|
evaluatePackageBody body
|
||||||
= withUnevaluatedModules (packageModules body)
|
= withUnevaluatedModules (packageModules body)
|
||||||
. withPrelude (packagePrelude body)
|
. withPrelude (packagePrelude body)
|
||||||
$ traverse evaluateEntryPoint (ModuleTable.toPairs (packageEntryPoints body))
|
$ traverse (uncurry evaluateEntryPoint) (ModuleTable.toPairs (packageEntryPoints body))
|
||||||
where
|
|
||||||
evaluateEntryPoint (m, sym) = do
|
evaluateEntryPoint :: ( Evaluatable (Base term)
|
||||||
v <- maybe unit (pure . snd) <$> requireWith evalModule m
|
, Member (EvalModule term value) effects
|
||||||
maybe v ((`call` []) <=< variable) sym
|
, 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)
|
withPrelude :: ( Evaluatable (Base term)
|
||||||
, Member (EvalModule term value) effects
|
, Member (EvalModule term value) effects
|
||||||
|
Loading…
Reference in New Issue
Block a user