#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Options

# Question 2.8 - Bifunctors

edited January 19

Bifunctors.

A bifunctor is a polymorphic type constructor F that takes two variables together with an implementation of a function:

bimap :: (a -> b) -> (c -> d) -> F a c -> F b d

Using the universal property of the coproduct, provide an implementation of bimap for the sum type constructor Either a b.

Comment Source:> bimap :: (a -> b) -> (c -> d) -> Either a c -> Either b d > bimap f g (Left x) = Left (f x) > bimap f g (Right y) = Right (g y)