1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Short-circuit the single incomparable elements case.

This commit is contained in:
Rob Rix 2017-06-13 15:19:43 -04:00
parent f3c02a0efa
commit 833d753a8c

View File

@ -59,7 +59,7 @@ rws :: (HasField fields (Maybe FeatureVector), Functor f, Eq1 f)
-> RWSEditScript f fields
rws _ _ as [] = This <$> as
rws _ _ [] bs = That <$> bs
rws _ canCompare [a] [b] | canCompareTerms canCompare a b = [These a b]
rws _ canCompare [a] [b] = if canCompareTerms canCompare a b then [These a b] else [That b, This a]
rws editDistance canCompare as bs = Eff.run . RWS.run editDistance canCompare as bs $ do
sesDiffs <- ses'
(featureAs, featureBs, mappedDiffs, allDiffs) <- genFeaturizedTermsAndDiffs' sesDiffs