1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

add localize

This commit is contained in:
Patrick Thomson 2018-03-16 16:00:49 -04:00
parent 96df75d5a3
commit b26780b539
2 changed files with 4 additions and 1 deletions

View File

@ -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 ()

View File

@ -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