mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Define a Foldable instance for Term.
This commit is contained in:
parent
a358be60cc
commit
ce02539dab
@ -74,6 +74,9 @@ instance Functor f => Comonad (Term f) where
|
||||
instance Functor f => Functor (Term f) where
|
||||
fmap f = go where go (Term (a :< r)) = Term (f a :< fmap go r)
|
||||
|
||||
instance Foldable f => Foldable (Term f) where
|
||||
foldMap f = go where go (Term (a :< r)) = f a `mappend` foldMap go r
|
||||
|
||||
instance Functor f => ComonadCofree f (Term f) where
|
||||
unwrap (Term (_ :< as)) = as
|
||||
{-# INLINE unwrap #-}
|
||||
|
Loading…
Reference in New Issue
Block a user