diff --git a/src/Control/Abstract/ScopeGraph.hs b/src/Control/Abstract/ScopeGraph.hs index e5c92624a..f64c07cbb 100644 --- a/src/Control/Abstract/ScopeGraph.hs +++ b/src/Control/Abstract/ScopeGraph.hs @@ -88,15 +88,15 @@ instance Effect (ScopeEnv address) where runScopeEnv :: (Ord address, Member Fresh sig, Member (Allocator address) sig, Carrier sig m, Effect sig) - => Evaluator term address value (ScopeEnvC - (Evaluator term address value (StateC (ScopeGraph address) - (Evaluator term address value m)))) a + => Evaluator term address value (ScopeEnvC (Eff + (StateC (ScopeGraph address) (Eff + m)))) a -> Evaluator term address value m (ScopeGraph address, a) -runScopeEnv = runState lowerBound . runEvaluator . runScopeEnvC . interpret . runEvaluator +runScopeEnv = Evaluator . runState lowerBound . runScopeEnvC . interpret . runEvaluator newtype ScopeEnvC m a = ScopeEnvC { runScopeEnvC :: m a } -instance (Ord address, Member Fresh sig, Member (Allocator address) sig, Carrier (State (ScopeGraph address) :+: sig) m, Effect sig) => Carrier (ScopeEnv address :+: sig) (ScopeEnvC (Evaluator term address value m)) where +instance (Ord address, Member Fresh sig, Member (Allocator address) sig, Carrier (State (ScopeGraph address) :+: sig) m, Effect sig) => Carrier (ScopeEnv address :+: sig) (ScopeEnvC (Eff m)) where ret = ScopeEnvC . ret eff = ScopeEnvC . (alg \/ (eff . R . handlePure runScopeEnvC)) where alg (Lookup ref k) = gets (ScopeGraph.scopeOfRef ref) >>= runScopeEnvC . k @@ -106,7 +106,7 @@ instance (Ord address, Member Fresh sig, Member (Allocator address) sig, Carrier alg (NewScope edges k) = do -- Take the edges and construct a new scope, update the current scope to the new scope name <- gensym - address <- alloc name + address <- runEvaluator (alloc name) modify @(ScopeGraph address) (ScopeGraph.newScope address edges) runScopeEnvC (k address) alg (CurrentScope k) = gets ScopeGraph.currentScope >>= runScopeEnvC . k diff --git a/src/Data/Abstract/Evaluatable.hs b/src/Data/Abstract/Evaluatable.hs index 74725afe0..b87449613 100644 --- a/src/Data/Abstract/Evaluatable.hs +++ b/src/Data/Abstract/Evaluatable.hs @@ -91,8 +91,8 @@ type ModuleC term address value m ( EnvC (Eff ( StateC (EvalContext address) (Eff ( StateC (Exports address) (Eff - ( ScopeEnvC (Evaluator term address value - ( StateC (ScopeGraph address) (Evaluator term address value + ( ScopeEnvC (Eff + ( StateC (ScopeGraph address) (Eff ( DerefC address value (Eff ( AllocatorC address (Eff ( ReaderC ModuleInfo (Eff