mirror of
https://github.com/github/semantic.git
synced 2024-12-23 14:54:16 +03:00
Handle the short-circuit cases early.
This commit is contained in:
parent
95b50b2dc4
commit
d5c9a68f78
@ -183,7 +183,9 @@ findNearestNeighbourTo' :: (Foldable syntax, Functor syntax, GAlign syntax)
|
|||||||
-> [UnmappedTerm syntax ann1]
|
-> [UnmappedTerm syntax ann1]
|
||||||
-> [UnmappedTerm syntax ann2]
|
-> [UnmappedTerm syntax ann2]
|
||||||
-> [MappedDiff syntax ann1 ann2]
|
-> [MappedDiff syntax ann1 ann2]
|
||||||
findNearestNeighbourTo' canCompare kdTreeA kdTreeB = go
|
findNearestNeighbourTo' _ _ _ _ as [] = This . (termIndex &&& term) <$> as
|
||||||
|
findNearestNeighbourTo' _ _ _ _ [] bs = That . (termIndex &&& term) <$> bs
|
||||||
|
findNearestNeighbourTo' canCompare kdTreeA kdTreeB i as bs = go i as bs
|
||||||
where go _ as [] = This . (termIndex &&& term) <$> as
|
where go _ as [] = This . (termIndex &&& term) <$> as
|
||||||
go _ [] bs = That . (termIndex &&& term) <$> bs
|
go _ [] bs = That . (termIndex &&& term) <$> bs
|
||||||
go previous unmappedA@(UnmappedTerm minA _ _ : _) (termB@(UnmappedTerm j _ b) : restUnmappedB) =
|
go previous unmappedA@(UnmappedTerm minA _ _ : _) (termB@(UnmappedTerm j _ b) : restUnmappedB) =
|
||||||
|
Loading…
Reference in New Issue
Block a user