1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 16:33:03 +03:00

Fold strictly.

This commit is contained in:
Rob Rix 2017-06-15 08:57:07 -04:00
parent 11859c9b51
commit e15f5ad7ab

View File

@ -206,7 +206,7 @@ insertion previous unmappedA unmappedB (UnmappedTerm j _ b) = do
genFeaturizedTermsAndDiffs :: (Functor f, HasField fields (Maybe FeatureVector))
=> RWSEditScript f fields
-> ([UnmappedTerm f fields], [UnmappedTerm f fields], [MappedDiff f fields], [TermOrIndexOrNone (UnmappedTerm f fields)])
genFeaturizedTermsAndDiffs = snd . foldl combine ((0, 0), ([], [], [], []))
genFeaturizedTermsAndDiffs = snd . foldl' combine ((0, 0), ([], [], [], []))
where combine ((counterA, counterB), (as, bs, mappedDiffs, allDiffs)) diff = case diff of
This term -> ((succ counterA, counterB), (featurize counterA term : as, bs, mappedDiffs, None : allDiffs))
That term -> ((counterA, succ counterB), (as, featurize counterB term : bs, mappedDiffs, Term (featurize counterB term) : allDiffs))