1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00

Run the continuation after the while loop.

This commit is contained in:
Rob Rix 2018-10-18 08:28:21 -04:00
parent f22972904e
commit 6391f14de5

View File

@ -137,7 +137,7 @@ instance ( Carrier sig m
gen = WhileC . gen gen = WhileC . gen
alg = WhileC . (algW \/ (alg . handlePure runWhileC)) alg = WhileC . (algW \/ (alg . handlePure runWhileC))
where algW = \case where algW = \case
Abstract.While cond body k -> loop $ \continue -> do Abstract.While cond body k -> loop (\continue -> do
cond' <- runWhileC cond cond' <- runWhileC cond
-- `interpose` is used to handle 'UnspecializedError's and abort out of the -- `interpose` is used to handle 'UnspecializedError's and abort out of the
@ -147,7 +147,7 @@ instance ( Carrier sig m
(\(Resumable (BaseError _ _ (UnspecializedError _)) k) -> throwAbort) $ (\(Resumable (BaseError _ _ (UnspecializedError _)) k) -> throwAbort) $
runEvaluator (runWhileC body *> continue) runEvaluator (runWhileC body *> continue)
ifthenelse cond' body' (runWhileC (k unit)) ifthenelse cond' body' (pure unit)) >>= runWhileC . k
where where
loop x = catchLoopControl (fix x) $ \case loop x = catchLoopControl (fix x) $ \case
Break value -> deref value Break value -> deref value