mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Define Traversable instances for Unions.
This commit is contained in:
parent
09d4dbcb8e
commit
0ad31e7887
@ -70,6 +70,14 @@ instance (Functor f, Functor (Union (g ': hs))) => Functor (Union (f ': g ': hs)
|
|||||||
fmap f (There t) = There (fmap f t)
|
fmap f (There t) = There (fmap f t)
|
||||||
|
|
||||||
|
|
||||||
|
instance Traversable f => Traversable (Union '[f]) where
|
||||||
|
traverse f = fmap Here . traverse f . strengthen
|
||||||
|
|
||||||
|
instance (Traversable f, Traversable (Union (g ': hs))) => Traversable (Union (f ': g ': hs)) where
|
||||||
|
traverse f (Here r) = Here <$> traverse f r
|
||||||
|
traverse f (There t) = There <$> traverse f t
|
||||||
|
|
||||||
|
|
||||||
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