From a7e4ed80157e119331c37a4de5fdda1f9a727cde Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 10 Mar 2017 10:56:32 -0500 Subject: [PATCH] Extract ceilDiv. --- src/SES/Myers.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SES/Myers.hs b/src/SES/Myers.hs index 16a8aebd5..b93602d62 100644 --- a/src/SES/Myers.hs +++ b/src/SES/Myers.hs @@ -66,9 +66,7 @@ decompose myers = case myers of if even delta && k `inInterval` (negate d, d) && overlaps forwardEndpoint reverseEndpoint then return (Just (Snake reverseEndpoint forwardEndpoint, EditDistance $ 2 * d)) else continue) - - where ceilDiv = (uncurry (+) .) . divMod - n = length as + where n = length as m = length bs delta = n - m maxD = (m + n) `ceilDiv` 2 @@ -112,6 +110,9 @@ for all run = foldr (\ a b -> (<|>) <$> run a <*> b) (return Nothing) all continue :: Myers (Maybe a) continue = return Nothing +ceilDiv :: Integral a => a -> a -> a +ceilDiv = (uncurry (+) .) . divMod + -- Instances