1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Model the state in Myers’ algorithm.

This commit is contained in:
Rob Rix 2017-03-09 10:30:42 -05:00
parent 384e016262
commit a400c8f2af

View File

@ -11,7 +11,13 @@ data MyersF a where
MiddleSnake :: Vector.Vector a -> Vector.Vector a -> MyersF (Snake, EditDistance) MiddleSnake :: Vector.Vector a -> Vector.Vector a -> MyersF (Snake, EditDistance)
FindDPath :: Direction -> EditDistance -> Diagonal -> MyersF Endpoint FindDPath :: Direction -> EditDistance -> Diagonal -> MyersF Endpoint
type Myers = Freer MyersF data StepF a where
M :: MyersF a -> StepF a
S :: State (MyersState a) a -> StepF a
data MyersState a = MyersState { forward :: !(Vector.Vector a), backward :: !(Vector.Vector a) }
type Myers = Freer StepF
data Snake = Snake { xy :: Endpoint, uv :: Endpoint } data Snake = Snake { xy :: Endpoint, uv :: Endpoint }