mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Extract the definition of the empty state.
This commit is contained in:
parent
315927763f
commit
beefe1ac20
@ -43,7 +43,7 @@ data Direction = Forward | Reverse
|
||||
-- Evaluation
|
||||
|
||||
runMyers :: HasCallStack => (a -> a -> Bool) -> Myers a b -> b
|
||||
runMyers eq = runAll $ MyersState (Vector.replicate 100 0) (Vector.replicate 100 0)
|
||||
runMyers eq = runAll emptyState
|
||||
where runAll state step = case runMyersStep eq state step of
|
||||
Left a -> a
|
||||
Right next -> uncurry runAll next
|
||||
@ -183,6 +183,9 @@ getEq = GetEq `Then` return
|
||||
|
||||
data MyersState = MyersState { forward :: !(Vector.Vector Int), backward :: !(Vector.Vector Int) }
|
||||
|
||||
emptyState :: MyersState
|
||||
emptyState = MyersState (Vector.replicate 100 0) (Vector.replicate 100 0)
|
||||
|
||||
setForward :: Vector.Vector Int -> Myers a ()
|
||||
setForward v = modify (\ s -> s { forward = v })
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user