# Natural transformation from the paper Comonadic UIs

**URL:** <https://discourse.haskell.org/t/natural-transformation-from-the-paper-comonadic-uis/4461>\
**Category:** Learn\
**Created:** [May 2, 2022, 1:39pm UTC](https://discourse.haskell.org/t/natural-transformation-from-the-paper-comonadic-uis/4461 "2022-05-02T13:39:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MasseR](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/masser/32/697_2.png) [@MasseR](https://discourse.haskell.org/u/MasseR)\
**Post date:** [May 2, 2022, 1:39pm UTC](https://discourse.haskell.org/t/natural-transformation-from-the-paper-comonadic-uis/4461/1 "2022-05-02T13:39:14Z")

</div>

In the small paper [PDF Declarative UIs are the Future — And the Future is Comonadic!](https://functorial.com/the-future-is-comonadic/main.pdf), 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`?

```haskell
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)

```
