From 95a800660e04aa696e9eb899ed539eaabbc4cf31 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 13 Mar 2017 11:35:11 -0400 Subject: [PATCH] runMyersSteps constructs the initial state itself. --- src/SES/Myers.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/SES/Myers.hs b/src/SES/Myers.hs index cf8107d03..df1705851 100644 --- a/src/SES/Myers.hs +++ b/src/SES/Myers.hs @@ -48,10 +48,11 @@ runMyers eq step = runAll (emptyStateForStep step) step Left a -> a Right next -> uncurry runAll next -runMyersSteps :: HasCallStack => (a -> a -> Bool) -> MyersState -> Myers a b -> [(MyersState, Myers a b)] -runMyersSteps eq state step = let ?callStack = popCallStack callStack in (state, step) : case runMyersStep eq state step of - Left result -> [ (state, return result) ] - Right next -> uncurry (runMyersSteps eq) next +runMyersSteps :: HasCallStack => (a -> a -> Bool) -> Myers a b -> [(MyersState, Myers a b)] +runMyersSteps eq step = go (emptyStateForStep step) step + where go state step = let ?callStack = popCallStack callStack in (state, step) : case runMyersStep eq state step of + Left result -> [ (state, return result) ] + Right next -> uncurry go next runMyersStep :: HasCallStack => (a -> a -> Bool) -> MyersState -> Myers a b -> Either b (MyersState, Myers a b) runMyersStep eq state step = let ?callStack = popCallStack callStack in case step of