try-catch

This commit is contained in:
2024-10-04 13:29:34 +02:00
parent fb7f5c936a
commit 46aa789d64
66 changed files with 564 additions and 0 deletions

View File

@ -13,4 +13,8 @@ runEval = runEval' envEmpty stateInitial
runEval' r s (Free (PrintOp p m)) =
let (ps, res) = runEval' r s m
in (p : ps, res)
runEval' r s (Free (TryCatchOp m l)) =
case (runEval' r s m) of
(_, Left e) -> runEval' r s l
a -> a
runEval' _ _ (Free (ErrorOp e)) = ([], Left e)