git @ Cat's Eye Technologies Quylthulg / a79f8fd
Fix bug in monadic interpreter, and indent if/then/else better. Chris Pressey 4 years ago
1 changed file(s) with 7 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
272272 mInterpret env lenv (ForEach loopvar listExpr accvar accExpr applyExpr elseExpr) = do
273273 list <- mInterpret env lenv listExpr
274274 acc <- mInterpret env lenv accExpr
275 if
276 list == Null
277 then
275 if list == Null then
278276 mInterpret env lenv elseExpr
279 else
277 else
280278 mqForEach list acc
281279 where
282280 mqForEach Null acc =
294292 extendEnv (extendEnv env accvar acc) loopvar (follow lenv first')
295293 ) lenv applyExpr
296294 newAcc <- do return (follow lenv result)
297 nextResult <- mqForEach rest' newAcc
298 return (if newAcc == Abort then
299 -- "abortable"
300 acc
301 else
302 follow lenv nextResult)
295 if newAcc == Abort then
296 return acc
297 else do
298 nextResult <- mqForEach rest' newAcc
299 return (follow lenv nextResult)
303300
304301 -- =========== --
305302 -- ParseEngine --