module Cat.Diagram.Comonad where
open Functor
open _=>_
module _ {o β} {C : Precategory o β} where
open Precategory C
Comonadsπ
A comonad on a category is dual to a monad on instead of a unit and multiplication we have a counit and comultiplication More generally, we can define what it means to equip a fixed functor with the structure of a comonad.
record Comonad-on (W : Functor C C) : Type (o β β) where
field
: W => Id
counit : W => (W Fβ W) comult
module counit = _=>_ counit renaming (Ξ· to Ξ΅)
module comult = _=>_ comult renaming (Ξ· to Ξ΄)
open Functor W renaming (Fβ to Wβ ; Fβ to Wβ ; F-id to W-id ; F-β to W-β) public
open counit using (Ξ΅) public
open comult using (Ξ΄) public
We also have equations governing the counit and comultiplication. Unsurprisingly, these are dual to the equations of a monad.
field
: β {x} β Wβ (Ξ΅ x) β Ξ΄ x β‘ id
Ξ΄-idl : β {x} β Ξ΅ (Wβ x) β Ξ΄ x β‘ id
Ξ΄-idr : β {x} β Wβ (Ξ΄ x) β Ξ΄ x β‘ Ξ΄ (Wβ x) β Ξ΄ x Ξ΄-assoc