poetix

this time for sure

Codata and Comonads

Just started reading this interesting paper on codata and comonads in Haskell programming. My intuitive and probably wrong understanding of codata is that it is like having a function between a domain and a codomain, and using an algebra on the domain whilst only being able to see the values in the codomain. It’s a sort of formalization of encapsulation or data hiding. But I’ve tried to understand coalgebra before, and come unstuck more or less immediately, so it’s quite likely that I’ve failed this time as well. At least this paper gives some concrete examples in Haskell code, which often helps.