Skip to content

Commit

Permalink
Fix bug in monadic interpreter, and indent if/then/else better.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpressey committed Apr 13, 2016
1 parent 05e9b2a commit a79f8fd
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/Qlzqqlzuup.hs
Expand Up @@ -273,11 +273,9 @@ mInterpret env lenv (BinOp op a b) = do
mInterpret env lenv (ForEach loopvar listExpr accvar accExpr applyExpr elseExpr) = do
list <- mInterpret env lenv listExpr
acc <- mInterpret env lenv accExpr
if
list == Null
then
if list == Null then
mInterpret env lenv elseExpr
else
else
mqForEach list acc
where
mqForEach Null acc =
Expand All @@ -295,12 +293,11 @@ mInterpret env lenv (ForEach loopvar listExpr accvar accExpr applyExpr elseExpr)
extendEnv (extendEnv env accvar acc) loopvar (follow lenv first')
) lenv applyExpr
newAcc <- do return (follow lenv result)
nextResult <- mqForEach rest' newAcc
return (if newAcc == Abort then
-- "abortable"
acc
else
follow lenv nextResult)
if newAcc == Abort then
return acc
else do
nextResult <- mqForEach rest' newAcc
return (follow lenv nextResult)

-- =========== --
-- ParseEngine --
Expand Down

0 comments on commit a79f8fd

Please sign in to comment.