1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +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 -> RWSEditScript f fields
rws _ _ as [] = This <$> as rws _ _ as [] = This <$> as
rws _ _ [] bs = That <$> bs 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 rws editDistance canCompare as bs = Eff.run . RWS.run editDistance canCompare as bs $ do
sesDiffs <- ses' sesDiffs <- ses'
(featureAs, featureBs, mappedDiffs, allDiffs) <- genFeaturizedTermsAndDiffs' sesDiffs (featureAs, featureBs, mappedDiffs, allDiffs) <- genFeaturizedTermsAndDiffs' sesDiffs