1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Take an Int instead of a Diagonal.

This commit is contained in:
Rob Rix 2017-03-09 14:01:52 -05:00
parent 9ab575b264
commit ad217cda68

View File

@ -68,10 +68,10 @@ getK :: Direction -> Diagonal -> Myers Endpoint
getK direction (Diagonal diagonal) = do
MyersState forward backward (Diagonal offset) <- get
let v = case direction of { Forward -> forward ; Reverse -> backward }
return $! v `at` Diagonal (offset + diagonal)
return $! v `at` (offset + diagonal)
at :: Vector.Vector Int -> Diagonal -> Endpoint
at v (Diagonal k) = Endpoint (v Vector.! k) 0
at :: Vector.Vector Int -> Int -> Endpoint
at v k = Endpoint (v Vector.! k) 0
overlaps :: Endpoint -> Endpoint -> Bool
overlaps (Endpoint x y) (Endpoint u v) = x - y == u - v && x <= u