In the small paper PDF Declarative UIs are the Future — And the Future is Comonadic!, Phil mentions that there is a natural transformation from Co f
and Co g
to Co (Day f g)
. Is he referring to having two separate transformations, one Co f ~> Co (Day f g)
and one for Co g ~> (Day f g)
or is it possible to write Co f a -> Co g a -> Co (Day f g) a
?
data Day f g a = forall x y. Day ( x -> y -> a ) (f x) (g y)
natF :: (Comonad f, Comonad g) => Co f a -> Co (Day f g) a
natF (Co wf) = Co $ \case
Day zap f g -> wf (fmap (\ x a -> zap x (extract g) a) f)
natG :: (Comonad f, Comonad g) => Co g a -> Co (Day f g) a
natG (Co wg) = Co $ \case
Day zap f g -> wg (fmap (zap (extract f)) g)