From 3ed7e1da53a4a247eb53b638339840185320d2e5 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 13 Jun 2017 18:22:48 -0400 Subject: [PATCH] Factor out the Diagonal construction. --- src/SES/Myers.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SES/Myers.hs b/src/SES/Myers.hs index f0c098acb..4d1bffceb 100644 --- a/src/SES/Myers.hs +++ b/src/SES/Myers.hs @@ -84,24 +84,24 @@ runSES eq (EditGraph as bs) -- | Move onto a given diagonal from one of its in-bounds adjacent diagonals (if any), and slide down any diagonal edges eagerly. moveFromAdjacent (Distance d) (Diagonal k) = do v <- get - let getK k = let (x, script) = v ! k in Endpoint x (x - unDiagonal k) script + let getK k = let (x, script) = v ! Diagonal k in Endpoint x (x - k) script let endpoint@(Endpoint x' _ script) = slideFrom $! if d == 0 || k < negate m || k > n then -- The top-left corner, or otherwise out-of-bounds. Endpoint 0 0 [] else if k == negate d || k == negate m then -- The lower/left extent of the search region or edit graph, whichever is smaller. - moveDownFrom (getK (Diagonal (succ k))) + moveDownFrom (getK (succ k)) else if k /= d && k /= n then do -- Somewhere in the interior of the search region and edit graph. - let prev = getK (Diagonal (pred k)) - let next = getK (Diagonal (succ k)) + let prev = getK (pred k) + let next = getK (succ k) if x prev < x next then moveDownFrom next else moveRightFrom prev else -- The upper/right extent of the search region or edit graph, whichever is smaller. - moveRightFrom (getK (Diagonal (pred k))) + moveRightFrom (getK (pred k)) put (v Array.// [(Diagonal k, (x', script))]) return endpoint