1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00

Rename the EvalModule/EvalClosure handlers.

This commit is contained in:
Rob Rix 2018-05-06 14:13:20 -04:00
parent 848543010d
commit 0334ab0ded

View File

@ -355,25 +355,25 @@ evaluatePackageBodyWith :: forall location term value effects termEffects module
evaluatePackageBodyWith perModule perTerm body evaluatePackageBodyWith perModule perTerm body
= handleReader (packageModules body) = handleReader (packageModules body)
. handleReader lowerBound . handleReader lowerBound
. handleEvalModules . runEvalModule
. withPrelude (packagePrelude body) . withPrelude (packagePrelude body)
$ traverse (uncurry evaluateEntryPoint) (ModuleTable.toPairs (packageEntryPoints body)) $ traverse (uncurry evaluateEntryPoint) (ModuleTable.toPairs (packageEntryPoints body))
where handleEvalModules :: Evaluator location term value (EvalModule term value ': packageBodyEffects) a -> Evaluator location term value packageBodyEffects a where runEvalModule :: Evaluator location term value (EvalModule term value ': packageBodyEffects) a -> Evaluator location term value packageBodyEffects a
handleEvalModules = raiseHandler (relay pure (\ (EvalModule m) yield -> lower (evalModule m) >>= yield)) runEvalModule = raiseHandler (relay pure (\ (EvalModule m) yield -> lower (evalModule m) >>= yield))
evalModule m evalModule m
= handleEvalModules = runEvalModule
. handleReader (moduleInfo m) . handleReader (moduleInfo m)
. perModule (subtermValue . moduleBody) . perModule (subtermValue . moduleBody)
. fmap (Subterm <*> evalTerm) . fmap (Subterm <*> evalTerm)
$ m $ m
handleEvalClosures = raiseHandler (relay pure (\ (EvalClosure term) yield -> lower (evalTerm term) >>= yield)) runEvalClosure = raiseHandler (relay pure (\ (EvalClosure term) yield -> lower (evalTerm term) >>= yield))
evalTerm evalTerm
= handleEvalClosures = runEvalClosure
. runReturn . runReturn
. runLoopControl . runLoopControl
. foldSubterms (perTerm eval) . foldSubterms (perTerm eval)
evaluateEntryPoint m sym = handleReader (ModuleInfo m) . handleEvalClosures . runReturn . runLoopControl $ do evaluateEntryPoint m sym = handleReader (ModuleInfo m) . runEvalClosure . runReturn . runLoopControl $ do
v <- maybe unit (pure . snd) <$> require m v <- maybe unit (pure . snd) <$> require m
maybe v ((`call` []) <=< variable) sym maybe v ((`call` []) <=< variable) sym