From 532b402d34559cfb009815cc7cf8c413382e0bb8 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 9 Mar 2017 15:34:14 -0500 Subject: [PATCH] =?UTF-8?q?Step-by-step=20computation=20of=20Myers?= =?UTF-8?q?=E2=80=99=20algorithm.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SES/Myers.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/SES/Myers.hs b/src/SES/Myers.hs index d4408b8cb..d8c63ff68 100644 --- a/src/SES/Myers.hs +++ b/src/SES/Myers.hs @@ -31,6 +31,16 @@ data Direction = Forward | Reverse -- Evaluation +runMyersStep :: MyersState -> Myers a -> Either a (MyersState, Myers a) +runMyersStep state step = case step of + Return a -> Left a + Then step cont -> case step of + M myers -> Right (state, decompose myers >>= cont) + + S Get -> Right (state, cont state) + S (Put state') -> Right (state', cont ()) + + decompose :: MyersF a -> Myers a decompose myers = case myers of SES {} -> return []