1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Give a type annotation for collect.

This commit is contained in:
Rob Rix 2017-10-27 10:21:21 -04:00
parent 328ef66a09
commit e16b7a9440

View File

@ -138,7 +138,8 @@ featureVectorDecorator :: (Hashable label, Traversable f) => Label f fields labe
featureVectorDecorator getLabel p q
= cata collect
. pqGramDecorator getLabel p q
where collect (In (gram :. rest) functor) = termIn (foldl' addSubtermVector (unitVector (hash gram)) functor :. rest) functor
where collect :: (Hashable label, Traversable f) => TermF f (Record (Gram label ': fields)) (Term f (Record (FeatureVector ': fields))) -> Term f (Record (FeatureVector ': fields))
collect (In (gram :. rest) functor) = termIn (foldl' addSubtermVector (unitVector (hash gram)) functor :. rest) functor
addSubtermVector :: Functor f => FeatureVector -> Term f (Record (FeatureVector ': fields)) -> FeatureVector
addSubtermVector v term = addVectors v (rhead (extract term))