compute distance in correct direction

This commit is contained in:
Joey Hess 2012-04-14 16:01:08 -04:00
parent 61e5663097
commit 70538dac84

View file

@ -34,7 +34,7 @@ fuzzymatches :: String -> (c -> String) -> [c] -> [c]
fuzzymatches input showchoice choices = fst $ unzip $ fuzzymatches input showchoice choices = fst $ unzip $
sortBy comparecost $ filter similarEnough $ zip choices costs sortBy comparecost $ filter similarEnough $ zip choices costs
where where
distance v = restrictedDamerauLevenshteinDistance gitEditCosts v input distance = restrictedDamerauLevenshteinDistance gitEditCosts input
costs = map (distance . showchoice) choices costs = map (distance . showchoice) choices
comparecost a b = compare (snd a) (snd b) comparecost a b = compare (snd a) (snd b)
similarEnough (_, cst) = cst < similarityFloor similarEnough (_, cst) = cst < similarityFloor