The choice of two containers is functorial, that is, given two
lenses a =%> a' and b =%> b', we can build the lens
a + b =%> a' + b'. We see this with the implementation of (~+~) which will be
the map on morphisms of our bifunctor.
Proposition
There is a bimap function on the coproduct of containers.
(~+~) : a =%> a' -> b =%> b' -> (a + b) =%> (a' + b')(~+~) x y = (bimap x.fwd y.fwd) <! (dchoice (\xy => x.bwd xy) (\xy => y.bwd xy) {c = \xa => (a' + b').response (bimap x.fwd y.fwd xa) -> choice (a .response) (b .response) xa} )
Using our bimap function we build the coproduct bifunctor on the category Cont