1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

Step-by-step computation of Myers’ algorithm.

This commit is contained in:
Rob Rix 2017-03-09 15:34:14 -05:00
parent 5a7cd8d6ab
commit 532b402d34

View File

@ -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 []