diff --git a/src/Control/Abstract/Evaluator.hs b/src/Control/Abstract/Evaluator.hs index 108d7691e..719aeac24 100644 --- a/src/Control/Abstract/Evaluator.hs +++ b/src/Control/Abstract/Evaluator.hs @@ -73,6 +73,9 @@ class Monad m => MonadEnvironment value m | m -> value where addr <- lookupLocalEnv name maybe (pure Nothing) (fmap Just . with) addr +localize :: MonadEnvironment value m => m a -> m a +localize = localEnv id + -- | Update the global environment. -- TODO: RENAME ME BECAUSE MY NAME IS A LIE modifyGlobalEnv :: MonadEnvironment value m => (EnvironmentFor value -> EnvironmentFor value) -> m () diff --git a/src/Control/Abstract/Value.hs b/src/Control/Abstract/Value.hs index 75fcf6338..d815113f8 100644 --- a/src/Control/Abstract/Value.hs +++ b/src/Control/Abstract/Value.hs @@ -109,7 +109,7 @@ forLoop :: (MonadEnvironment value m, MonadValue value m) -> m value -- ^ Body -> m value forLoop initial cond step body = - localEnv id (initial *> while cond (body *> step)) + localize (initial *> while cond (body *> step)) -- | The fundamental looping primitive, built on top of ifthenelse. while :: MonadValue value m