Data.Functor.Coproduct

comonad-transformers-2.0.2: Comonad transformers

Portability | portable
Stability | provisional
Maintainer | Edward Kmett <ekmett@gmail.com>

Data.Functor.Coproduct

Description

# Documentation

newtype Coproduct f g a

Constructors

Coproduct |
Fields getCoproduct :: Either (f a) (g a)

Instances

(Functor f, Functor g) => Functor (Coproduct f g) |
(Foldable f, Foldable g) => Foldable (Coproduct f g) |
(Traversable f, Traversable g) => Traversable (Coproduct f g) |
(Comonad f, Comonad g) => Comonad (Coproduct f g) |
(Extend f, Extend g) => Extend (Coproduct f g) |
(Contravariant f, Contravariant g) => Contravariant (Coproduct f g) |
(Traversable1 f, Traversable1 g) => Traversable1 (Coproduct f g) |
(Foldable1 f, Foldable1 g) => Foldable1 (Coproduct f g) |

left :: f a -> Coproduct f g a

right :: g a -> Coproduct f g a

coproduct :: (f a -> b) -> (g a -> b) -> Coproduct f g a -> b