# About Comonads for UIs

**URL:** <https://discourse.haskell.org/t/about-comonads-for-uis/12005>\
**Category:** Learn\
**Created:** [May 4, 2025, 4:59pm UTC](https://discourse.haskell.org/t/about-comonads-for-uis/12005 "2025-05-04T16:59:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryba](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@Ryba](https://discourse.haskell.org/u/Ryba)\
**Post date:** [May 4, 2025, 4:59pm UTC](https://discourse.haskell.org/t/about-comonads-for-uis/12005/1 "2025-05-04T16:59:45Z")

</div>

I’ve come upon [this paper](https://arthurxavierx.github.io/ComonadsForUIs.pdf) some time ago and it was sitting in the back of my mind and I want to explore the concept. It seems that there are no real-world uses of this concept. Any reason why that may be the case? Is this impractical for some reason or it just happened that noone picked this up?

---

<div class="post-metadata">

**Author:** ![Liamzy](https://avatars.discourse-cdn.com/v4/letter/l/50afbb/32.png) [@Liamzy](https://discourse.haskell.org/u/Liamzy)\
**Post date:** [May 4, 2025, 7:07pm UTC](https://discourse.haskell.org/t/about-comonads-for-uis/12005/2 "2025-05-04T19:07:48Z")

</div>

Edit: to explain what I’m talking about about, I found the same paper and did my own spelunking. But if comonads are close to a functional encoding of objects, one, does the relationship between comonads and lenses render them irrelevant? Two, does comonadic GUI simply turn into a rehash of OOP GUI, an approach that OOP is good at? On the other hand, functional rehashes of imperative concepts ARE an interesting research angle; the IO type gave birth to the do interface, and between do and `class Applicative m => Monad m` we have a lot of fun research and exploration of what we can do with monadic types and effect systems.

* * *

I haven’t fully done the research, but an interesting angle is the relationship between comonads and lenses. There’s also a disputed article by Gabriella Gonzalez calling comonads objects:

> **[Comonads are objects](https://www.haskellforall.com/2013/02/you-could-have-invented-comonads.html?m=1)**
>
> Haskell programmers popularized the use of monads to structure imperative computations, complete with syntactic sugar in the form of do not...

> **[Comonads are neighbourhoods, not objects](https://gelisam.blogspot.com/2013/07/comonads-are-neighbourhoods-not-objects.html?m=1)**
>
> Gabriel Gonzalez, the author of the well-known pipes package, has written a blog post in which he claims that comonads are objects. I thin...

Read this retort as well.

---

<div class="post-metadata">

**Author:** ![darkxero](https://avatars.discourse-cdn.com/v4/letter/d/f07891/32.png) [@darkxero](https://discourse.haskell.org/u/darkxero)\
**Post date:** [May 4, 2025, 7:31pm UTC](https://discourse.haskell.org/t/about-comonads-for-uis/12005/3 "2025-05-04T19:31:19Z")

</div>

> [@Ryba](#):
>
> It seems that there are no real-world uses of this concept.

Well, according to the paper the Elm Architecture is a specialization of the concept, so you could argue it has real-world uses (and it is liked by people that use it).

> [@Ryba](#):
>
> Any reason why that may be the case? Is this impractical for some reason or it just happened that noone picked this up?

For starters I never heard of it or thought about it.

The author also hints that

> The complexity of the concepts involved in this model, however, may impose a great  
> difficulty on its adoption for the development of real-world applications. One limitation of the technique, in the way it is presented in this thesis, is that it is considerably difficult to generate or discover monads that may be used to describe movements in a space defined a comonad; that is, it is difficult to find pairings between comonads and monads.

and

> By using a technique proposed by Kmett [2011] (and used by Freeman [2016b] in the original model), we shall be able to to eliminate the necessity of finding or developing specific monads and pairings for given comonads, something that has been shown an extremely laborious task.

So basically you need to be Edward Kmett to do UI, haha.
