The monad from an adjunction🔗

module
  Cat.Functor.Adjoint.Monad
  {o₁ h₁ o₂ h₂ : _}
  {C : Precategory o₁ h₁}
  {D : Precategory o₂ h₂}
  {L : Functor C D} {R : Functor D C}
  (L⊣R : L ⊣ R)
  where

Every adjunction gives rise to a monad, where the underlying functor is

Adjunction→Monad : Monad C
Adjunction→Monad .M = R F∘ L

The unit of the monad is just adjunction monad, and the multiplication comes from the counit.

Adjunction→Monad .unit = adj.unit
Adjunction→Monad .mult = NT  x  R.(adj.ε (L.₀ x))) λ x y f 
  R.(adj.ε (L.₀ y)) C.∘ R.(L.(R.(L.₁ f))) ≡⟨ sym (R.F-∘ _ _)
  R.(adj.ε (L.₀ y) D.∘ L.(R.(L.₁ f)))       ≡⟨ ap R.(adj.counit.is-natural _ _ _)
  R.(L.₁ f D.∘ adj.ε (L.₀ x))                   ≡⟨ R.F-∘ _ _
  _

The monad laws follow from the zig-zag identities. In fact, the right-identity law is exactly the zag identity.

Adjunction→Monad .right-ident {x} = adj.zag

The others are slightly more involved.

Adjunction→Monad .left-ident {x} = path where abstract
  path : R.(adj.ε (L.F₀ x)) C.∘ R.(L.(adj.η x)) ≡ C.id
  path =
    R.(adj.ε _) C.∘ R.(L.(adj.η _)) ≡⟨ sym (R.F-∘ _ _)
    R.(adj.ε _ D.∘ L.(adj.η _))       ≡⟨ ap R.₁ adj.zig ⟩
    R.₁ D.id                              ≡⟨ R.F-id ⟩
    C.id                                  ∎

Adjunction→Monad .mult-assoc {x} = path where abstract
  path : R.(adj.ε _) C.∘ R.(L.(R.(adj.ε (L.F₀ x))))
       ≡ R.(adj.ε _) C.∘ R.(adj.ε (L .F₀ (R.F₀ (L.F₀ x))))
  path =
    R.(adj.ε _) C.∘ R.(L.(R.(adj.ε _)))   ≡⟨ sym (R.F-∘ _ _)
    R.(adj.ε _ D.∘ L.(R.(adj.ε _)))         ≡⟨ ap R.(adj.counit.is-natural _ _ _)
    R.(adj.ε _ D.∘ adj.ε _)                     ≡⟨ R.F-∘ _ _
    R.(adj.ε _) C.∘ R.(adj.ε _)