mirror of
https://github.com/github/semantic.git
synced 2024-12-22 06:11:49 +03:00
Simplify mapAnnotations with the Bifunctor instance.
This commit is contained in:
parent
d1c9c69ed8
commit
4fe2a4cec1
@ -44,7 +44,7 @@ mapAnnotations :: (Functor f, Functor g)
|
|||||||
=> (annotation -> annotation')
|
=> (annotation -> annotation')
|
||||||
-> Free (TermF f (g annotation)) (Patch (Term f annotation))
|
-> Free (TermF f (g annotation)) (Patch (Term f annotation))
|
||||||
-> Free (TermF f (g annotation')) (Patch (Term f annotation'))
|
-> Free (TermF f (g annotation')) (Patch (Term f annotation'))
|
||||||
mapAnnotations f = iter (\ (h :< functor) -> wrap (fmap f h :< functor)) . fmap (pure . fmap (fmap f))
|
mapAnnotations f = iter (wrap . first (fmap f)) . fmap (pure . fmap (fmap f))
|
||||||
|
|
||||||
-- | Map a function over the annotations of a single diff node, if it is in Free.
|
-- | 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 :: (Functor f, Functor g) => (annotation -> annotation) -> Free (TermF f (g annotation)) a -> Free (TermF f (g annotation)) a
|
||||||
|
Loading…
Reference in New Issue
Block a user