1
1
mirror of https://github.com/github/semantic.git synced 2025-01-02 20:41:38 +03:00

📝 modifyAnnotations.

This commit is contained in:
Rob Rix 2017-02-08 12:04:05 -05:00
parent 051916082a
commit d9e44ede6c

View File

@ -53,6 +53,7 @@ mapAnnotations :: (Functor f, Functor g)
mapAnnotations f = iter (\ (h :< functor) -> wrap (fmap f h :< functor)) . fmap (pure . fmap (fmap f))
-- | Map a function over the annotations of a single diff node, if it is in Free.
modifyAnnotations :: (Functor f, Functor g) => (annotation -> annotation) -> Free (TermF f (g annotation)) a -> Free (TermF f (g annotation)) a
modifyAnnotations f r = case runFree r of
Free (ga :< functor) -> wrap (fmap f ga :< functor)