mirror of
https://github.com/github/semantic.git
synced 2024-12-24 07:25:44 +03:00
add localize
This commit is contained in:
parent
96df75d5a3
commit
b26780b539
@ -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 ()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user