-
Notifications
You must be signed in to change notification settings - Fork 73
Add Action monad #502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Action monad #502
Conversation
JacquesCarette
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Closes #498
I'd like to share the commutative diagrams I made while trying to understand how to implement this:
Associativity:

Left identity:

Right identity:

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.