2
votes

In the paper Declarative UIs are the future -- and the future is comonadic by Phil Friedman, he makes the claim, when introducing the cofree comonad that:

...this approach is reminiscent of the approach taken in the Halogen user interface library.

This claim is echoed in several other places, I assume originating from this paper, and until recently I just put this on my "think about more later" pile, because I was not familiar with how Halogen worked. However, now that I am somewhat familiar with Halogen, I tried looking into this matter more. However, even now that I understand the basics of Halogen, this claim is still not immediately obvious to me, and at least as far as I've searched, I have not found anywhere online that attempts to elaborate on or explain this connection between the cofree comonad and Halogen.

Has anyone attempted to actually build a UI framework using the cofree comonad? If not, could someone at least help explain this idea a little bit better? For instance, by taking some basic example of a component in Halogen, and constructing a structure that describes that component using a cofree comonad? Or even better, describing how these "cofree components" can be combined in a similar way to how Halogen components can be composed?

1

1 Answers

1
votes

The paper says "Under certain conditions on f, the Co (Cofree f) monad is isomorphic to a free monad which is determined by f." and HalogenM is a free monad. I don't think there's more to it than that.