1
1
mirror of https://github.com/github/semantic.git synced 2025-01-05 05:58:34 +03:00

Simplify the carrier for runPythonPackaging.

This commit is contained in:
Rob Rix 2018-10-26 12:30:06 -04:00
parent 24660fca31
commit 37d4fea7b2

View File

@ -38,11 +38,10 @@ runPythonPackaging :: ( Carrier sig m
, Member (Reader Span) sig , Member (Reader Span) sig
, Member (Function term address (Value term address)) sig , Member (Function term address (Value term address)) sig
) )
=> Evaluator term address (Value term address) (InterposeC (Function term address (Value term address)) => Evaluator term address (Value term address) (InterposeC (Function term address (Value term address)) (Eff m)) a
(Evaluator term address (Value term address) m)) a
-> Evaluator term address (Value term address) m a -> Evaluator term address (Value term address) m a
runPythonPackaging = interpose (\case runPythonPackaging = raiseHandler $ interpose (runEvaluator . \case
Call callName super params k -> k =<< do Call callName super params k -> Evaluator . k =<< do
case callName of case callName of
Closure _ _ name' paramNames _ _ -> do Closure _ _ name' paramNames _ _ -> do
let bindings = foldr (uncurry Map.insert) lowerBound (zip paramNames params) let bindings = foldr (uncurry Map.insert) lowerBound (zip paramNames params)
@ -63,9 +62,8 @@ runPythonPackaging = interpose (\case
_ -> pure () _ -> pure ()
_ -> pure () _ -> pure ()
call callName super params call callName super params
Function name params body k -> function name params body >>= k Function name params body k -> function name params body >>= Evaluator . k
BuiltIn b k -> builtIn b >>= k) BuiltIn b k -> builtIn b >>= Evaluator . k)
. runEvaluator
interpose :: (Member eff sig, HFunctor eff, Carrier sig m) interpose :: (Member eff sig, HFunctor eff, Carrier sig m)
=> (forall v. eff m (m v) -> m v) => (forall v. eff m (m v) -> m v)