1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Reformat pqGramDecorator’s type signature for 📝s.

This commit is contained in:
Rob Rix 2016-08-10 15:51:24 -04:00
parent db75159a63
commit 98f54cabd2

View File

@ -60,7 +60,12 @@ data Gram label = Gram { stem :: [Maybe label], base :: [Maybe label] }
deriving (Eq, Show)
-- | Annotates a term with the corresponding p,q-gram at each node.
pqGramDecorator :: Traversable f => (forall b. CofreeF f (Record fields) b -> label) -> Int -> Int -> Cofree f (Record fields) -> Cofree f (Record (Gram label ': fields))
pqGramDecorator :: Traversable f
=> (forall b. CofreeF f (Record fields) b -> label)
-> Int
-> Int
-> Cofree f (Record fields)
-> Cofree f (Record (Gram label ': fields))
pqGramDecorator getLabel p q = cata algebra
where algebra term = let label = getLabel term in
cofree ((Gram (padToSize p []) (padToSize q (pure (Just label))) .: headF term) :< (`evalState` (siblingLabels (tailF term))) (for (tailF term) (assignLabels label)))