summaryrefslogtreecommitdiff
path: root/src/Run/Monad.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2024-11-09 19:29:06 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2024-11-09 19:29:06 +0100
commit6447095bcffd101507afb65854da22bd4ee6fcaa (patch)
tree749b7ef6b13aaeb209013f26546f97e8d6670c8b /src/Run/Monad.hs
parent0c8bad166577f9973ba5701aee5ca5d9a3f3bc5d (diff)
Move withVar into MonadEval type class
Diffstat (limited to 'src/Run/Monad.hs')
-rw-r--r--src/Run/Monad.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Run/Monad.hs b/src/Run/Monad.hs
index 9ec9065..1890572 100644
--- a/src/Run/Monad.hs
+++ b/src/Run/Monad.hs
@@ -96,6 +96,8 @@ instance MonadEval TestRun where
lookupVar name = maybe (fail $ "variable not in scope: '" ++ unpackVarName name ++ "'") return =<< asks (lookup name . tsVars . snd)
rootNetwork = asks $ tsNetwork . snd
+ withVar name value = local (fmap $ \s -> s { tsVars = ( name, SomeVarValue mempty $ const $ const value ) : tsVars s })
+
instance MonadOutput TestRun where
getOutput = asks $ teOutput . fst