summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDougal <d.maclaurin@gmail.com>2024-01-08 12:55:06 -0500
committerDougal <d.maclaurin@gmail.com>2024-01-08 12:55:06 -0500
commitbf4ccc43aafb67beeb5106d11c6dbff8d1f50997 (patch)
treecae99c608b9c99774f61af8c8d583315f895b612
parent8ef1fdee3f933d5528c54ddd089f73f8fc48704b (diff)
Fix discrepancy between dynamic and static versions of notebook.
-rw-r--r--src/lib/Live/Eval.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib/Live/Eval.hs b/src/lib/Live/Eval.hs
index 7af2c58d..094a9e7c 100644
--- a/src/lib/Live/Eval.hs
+++ b/src/lib/Live/Eval.hs
@@ -55,13 +55,17 @@ evalFileNonInteractive fname cfg initEnv = do
envRef <- newIORef initEnv
blocks <- parseSourceBlocks <$> readFileText fname
cellStates <- forM blocks \block -> do
- env <- readIORef envRef
- ((exitStatus, newEnv), outs) <- captureLogs \logger ->
- evalSourceBlockIO cfg logger env block
- writeIORef envRef newEnv
- return $ CellState block (exitStatusAsCellStatus exitStatus) outs
+ if isInert block
+ then return $ CellState block Inert mempty
+ else do
+ env <- readIORef envRef
+ ((exitStatus, newEnv), outs) <- captureLogs \logger ->
+ evalSourceBlockIO cfg logger env block
+ writeIORef envRef newEnv
+ return $ CellState block (exitStatusAsCellStatus exitStatus) outs
runFreshNameT $ buildNodeList cellStates
+
-- === DAG diff state ===
-- We intend to make this an arbitrary Dag at some point but for now we just