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

Short-circuit the single comparable elements case.

This commit is contained in:
Rob Rix 2017-06-13 15:13:57 -04:00
parent 5762c4d405
commit f3c02a0efa

View File

@ -59,6 +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 editDistance canCompare as bs = Eff.run . RWS.run editDistance canCompare as bs $ do
sesDiffs <- ses'
(featureAs, featureBs, mappedDiffs, allDiffs) <- genFeaturizedTermsAndDiffs' sesDiffs