$\begingroup$

Let $C$ be a CCC. Let $(\times)$ be a product bifunctor on $C$. As Cat is CCC, we can curry $(\times)$:

$curry (\times) : C \rightarrow(C \Rightarrow C)$

$curry (\times) A = \lambda B. A \times B$

Functor category $C \Rightarrow C$ has usual monoidal structure. A monoid in $C \Rightarrow C$ is a monad in $C$. We consider finite products as monoidal structure on $C$.

$curry (\times) 1 \cong id$

$\forall A\ B. curry (\times) (A\times B) \cong (curry (\times) A) \circ (curry (\times) B)$

Therefore $(curry (\times))$ preserves monoidal structure, so it transports a monoid to a monad and a comonoid to a comonad. Namely, it transports an arbitrary monoid $w$ to $(Writer\ w)$ monad (look at the definition — $w$ must be a monoid). Similarly it transports the diagonal comonoid to the Coreader comonad.

Now, for concreteness, I unfold the construction of Writer.

Begin. Actually $Writer = Coreader = curry(\times)$, they simply have distinct names in Haskell. We have a Haskell monoid $\langle w, mappend, mempty\rangle$:

$mappend : w\times w \to w$

$mempty : 1 \to w$

Writer is a functor, so it must map also morphisms, such as $mappend$ and $mempty$. I write this as below, though it is invalid in Haskell:

$Writer\ mappend : Writer(w\times w) \to Writer\ w$

$Writer\ mappend$ is a natural transformation, a morphism in $C\Rightarrow C$. By properties of $curry(\times)$ it is a function, which takes $a \in Ob(C)$ and gives a morphism in $C$:

$Writer\ mappend\ a = mappend\times(id(a)) : Writer (w\times w) a \to Writer\ w\ a$

Informally, $Writer\ mappend\ a$ sums components of type $w$ and pumps $a$ intact. This is exactly the definition of Writer in Haskell. One obstacle is that for the monad $\langle Writer\ w,\mu,\eta\rangle$ we need

$\mu : Writer\ w \circ Writer\ w \to Writer\ w$

i.e. incompatibility of types. But these functors are isomorphic: $Writer (w\times w) = \lambda a. (w\times w)\times a$ by the usual associator for finite products which is a natural isomorphism $\cong \lambda a. w\times(w\times a) = Writer\ w \circ Writer\ w$. Then we define $\mu$ via $Writer\ mappend$. I omit a construction of $\eta$ via $mempty$.

Writer, being a functor, preserves commutative diagrams, i.e. preserves monoid equalities, so we have for granted proved equalities for $\langle Writer\ w,\mu,\eta\rangle$ = a monoid in $(C\Rightarrow C)$ = a monad in $C$. End.

What about Reader and Cowriter? Reader is adjoint to Coreader, as explained in the definition of Coreader, see link above. Similarly, Cowriter is adjoint to Writer. I did not find a definition of Cowriter, so I made it up by analogy shown in the table:

{- base, Hackage.category-extras -} import Control.Comonad import Data.Monoid data Cowriter w a = Cowriter (w -> a) instance Functor (Cowriter w) where fmap f (Cowriter g) = Cowriter (f . g) instance Monoid w => Copointed (Cowriter w) where extract (Cowriter g) = g mempty instance Monoid w => Comonad (Cowriter w) where duplicate (Cowriter g) = Cowriter (\w' -> Cowriter (\w -> g (w `mappend` w')))

Below are the simplified definitions of those (co)monads. fr_ob F denotes a mapping of a functor F on objects, fr_mor F denotes a mapping of a functor F on morphisms. There is a monoid object $\langle w,\hat{+},\hat{0}\rangle$ in $C$.

Writer $fr\_ob (Writer\ w) a = a\times w$ $fr\_mor (Writer\ w) f = \lambda \langle a_0,w_2\rangle. \langle a_0,f\ w_2\rangle$ $\eta a = \lambda a_0. \langle a_0, \hat{0} \rangle$ $\mu a = \lambda \langle \langle a_0,w_1\rangle,w_0\rangle. \langle a_0, w_0\hat{+}w_1\rangle$

Reader $fr\_ob (Reader\ r) a = r\to a$ $fr\_mor (Reader\ r) f = \lambda g\ r_0. f (g\ r_0)$ $\eta a = \lambda a_0\ r_0. a_0$ $\mu a = \lambda f\ r_0. f\ r_0\ r_0$

Coreader $fr\_ob (Coreader\ r) a = r\times a$ $fr\_mor (Coreader\ r) f = \lambda \langle r_0,a_0\rangle. \langle f\ r_0,a_0\rangle$ $\eta a = \lambda \langle r_0,a_0\rangle. a_0$ $\mu a = \lambda \langle r_0,a_0\rangle. \langle r_0,\langle r_0,a_0\rangle\rangle$

Cowriter $fr\_ob (Cowriter\ w) a = w\to a$ $fr\_mor (Cowriter\ w) f = \lambda g\ r_0. f (g\ r_0)$ $\eta a = \lambda f. f\ \hat{0}$ $\mu a = \lambda f\ w_1 w_0. f (w_0\hat{+}w_1)$



The question is that the adjunction in $C$ relates functors, not monads. I do not see how the adjunction implies "Coreader is a comonad" $\to$ "Reader is a monad" and "Writer is a monad" $\to$ "Cowriter is a comonad".

Remark. I am struggling to provide more context. It requires some work. Especially, if you require categorical purity and those (co)monads were introduced for programmers. Keep nagging! ;)