Skip to content

Conversation

@Taneb
Copy link
Member

@Taneb Taneb commented Dec 12, 2025

Closes #498

I'd like to share the commutative diagrams I made while trying to understand how to implement this:

Associativity:
writer-assoc

Left identity:
writer-identityl

Right identity:
writer-identityr

In the issue I noted that this could be extended to a strong monad transformer - that comes from the fact that any pair of monads with a distributive property compose, which I think should be proven separately.

@Taneb Taneb requested a review from JacquesCarette December 13, 2025 15:35
Copy link
Collaborator

@JacquesCarette JacquesCarette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. Some picky comments.


{-# OPTIONS --safe --without-K #-}

open import Categories.Category
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please restrict all open import via using. Do use Categories.Category.Core when at top-level just for 'Category'.

module A = Functor ActionF

η : ∀ X → X ⇒ A.₀ X
η X = m.η ⊗₁ id ∘ unitorˡ.to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shorthands has things for unitors and associators; probably best to use them throughout the file.

Monoid⇒-Monad⇒ : ∀ {m n} → Monoid⇒ m n → Monad⇒-id (ActionM n) (ActionM m)
Monoid⇒-Monad⇒ {m} {n} f = record
{ α = ntHelper record
{ η = λ X → arr ⊗₁ id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do _ names that are not used in the rhs of a lambda.

@Taneb Taneb requested a review from JacquesCarette December 17, 2025 09:56
@JacquesCarette JacquesCarette merged commit 56790e4 into master Dec 17, 2025
1 check passed
@JacquesCarette JacquesCarette deleted the action-monad branch December 17, 2025 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Writer monad

3 participants