Interaction Laws of Monads and Comonads
Abstract
We introduce and study functor-functor and monad-comonad interaction laws as math-ematical objects to describe interaction of effectful computations with behaviors of effect-performingmachines. Monad-comonad interaction laws are monoid objects of the monoidal category of functor-functor interaction laws. We show that, for suitable generalizations of the concepts of dual andSweedler dual, the greatest functor resp. monad interacting with a given functor or comonad is itsdual while the greatest comonad interacting with a given monad is its Sweedler dual. We relatemonad-comonad interaction laws to stateful runners. We show that functor-functor interaction lawsare Chu spaces over the category of endofunctors taken with the Day convolution monoidal struc-ture. Hasegawa’s glueing endows the category of these Chu spaces with a monoidal structure whosemonoid objects are monad-comonad interaction laws.