mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
Define Foldable instances for Unions.
This commit is contained in:
parent
68724970d0
commit
b0700242ee
@ -44,6 +44,14 @@ instance {-# OVERLAPPABLE #-} InUnion fs f => InUnion (g ': fs) f where
|
|||||||
proj _ = Nothing
|
proj _ = Nothing
|
||||||
|
|
||||||
|
|
||||||
|
instance (Foldable f, Foldable (Union fs)) => Foldable (Union (f ': fs)) where
|
||||||
|
foldMap f (Here r) = foldMap f r
|
||||||
|
foldMap f (There t) = foldMap f t
|
||||||
|
|
||||||
|
instance Foldable (Union '[]) where
|
||||||
|
foldMap _ _ = mempty
|
||||||
|
|
||||||
|
|
||||||
instance (Eq (f a), Eq (Union fs a)) => Eq (Union (f ': fs) a) where
|
instance (Eq (f a), Eq (Union fs a)) => Eq (Union (f ': fs) a) where
|
||||||
Here f1 == Here f2 = f1 == f2
|
Here f1 == Here f2 = f1 == f2
|
||||||
There fs1 == There fs2 = fs1 == fs2
|
There fs1 == There fs2 = fs1 == fs2
|
||||||
|
Loading…
Reference in New Issue
Block a user