From 6391f14de5b92972dca76a2e5bd163ed3a38fbe3 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 18 Oct 2018 08:28:21 -0400 Subject: [PATCH] Run the continuation after the while loop. --- src/Data/Abstract/Value/Concrete.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Abstract/Value/Concrete.hs b/src/Data/Abstract/Value/Concrete.hs index 77a0dfd1d..bde7dc4f1 100644 --- a/src/Data/Abstract/Value/Concrete.hs +++ b/src/Data/Abstract/Value/Concrete.hs @@ -137,7 +137,7 @@ instance ( Carrier sig m gen = WhileC . gen alg = WhileC . (algW \/ (alg . handlePure runWhileC)) where algW = \case - Abstract.While cond body k -> loop $ \continue -> do + Abstract.While cond body k -> loop (\continue -> do cond' <- runWhileC cond -- `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) $ runEvaluator (runWhileC body *> continue) - ifthenelse cond' body' (runWhileC (k unit)) + ifthenelse cond' body' (pure unit)) >>= runWhileC . k where loop x = catchLoopControl (fix x) $ \case Break value -> deref value