1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +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)
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)
FindDPath :: Direction -> EditDistance -> Diagonal -> MyersF Endpoint
@ -43,9 +43,11 @@ runMyersStep state step = case step of
decompose :: MyersF a -> Myers a
decompose myers = case myers of
SES as [] -> return (This <$> as)
SES [] bs -> return (That <$> bs)
SES {} -> return []
SES as bs
| null bs -> return (This <$> toList as)
| null as -> return (That <$> toList bs)
| otherwise -> do
return []
MiddleSnake as bs -> fmap (fromMaybe (error "bleah")) $
for [0..maxD] $ \ d ->