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

SES operates on Vectors.

This commit is contained in:
Rob Rix 2017-03-10 10:21:38 -05:00
parent 5a6bd8c547
commit 8ca75fb092

View File

@ -7,7 +7,7 @@ import qualified Data.Vector as Vector
import Prologue hiding (for, State) import Prologue hiding (for, State)
data MyersF a where data MyersF a where
SES :: [a] -> [a] -> MyersF [These a a] SES :: Vector.Vector a -> Vector.Vector a -> MyersF [These a a]
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
@ -43,9 +43,11 @@ runMyersStep state step = case step of
decompose :: MyersF a -> Myers a decompose :: MyersF a -> Myers a
decompose myers = case myers of decompose myers = case myers of
SES as [] -> return (This <$> as) SES as bs
SES [] bs -> return (That <$> bs) | null bs -> return (This <$> toList as)
SES {} -> return [] | null as -> return (That <$> toList bs)
| otherwise -> do
return []
MiddleSnake as bs -> fmap (fromMaybe (error "bleah")) $ MiddleSnake as bs -> fmap (fromMaybe (error "bleah")) $
for [0..maxD] $ \ d -> for [0..maxD] $ \ d ->