You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Buried in the old categories library, I found the following gems:
map⁎ :∀ {a b p q} {A :Set a} {B : A →Set b} {P : A →Set p} {Q : {x : A} → P x → B x →Set q} →
(f : (x : A) → B x) → (∀ {x} → (y : P x) → Q y (f x)) → (v : Σ A P) → Σ (B (proj₁ v)) (Q (proj₂ v))
map⁎ f g (x , y) = (f x , g y)
map⁎′ :∀ {a b p q} {A :Set a} {B : A →Set b} {P :Set p} {Q : P →Set q} → (f : (x : A) → B x) → ((x : P) → Q x) → (v : A × P) → B (proj₁ v) × Q (proj₂ v)
map⁎′ f g (x , y) = (f x , g y)
zipWith :∀ {a b c p q r s} {A :Set a} {B :Set b} {C :Set c} {P : A →Set p} {Q : B →Set q} {R : C →Set r} {S : (x : C) → R x →Set s} (_∙_ : A → B → C) → (_∘_ :∀ {x y} → P x → Q y → R (x ∙ y)) → (_*_ : (x : C) → (y : R x) → S x y) → (x : Σ A P) → (y : Σ B Q) → S (proj₁ x ∙ proj₁ y) (proj₂ x ∘ proj₂ y)
zipWith _∙_ _∘_ _*_ (a , p) (b , q) = (a ∙ b) * (p ∘ q)
Should these be added to the standard library?
The text was updated successfully, but these errors were encountered:
Oh wow, those are fun! Yes, they'd be good to add. The zipWith name is consistent I think. I'm not sure what to call the map variants? Are people happy with map*? The one thing that definitely needs to be changed is that the ′ needs to be turned in a \prime.
I'm not particularly pleased with map* (that's the name in the library, not mine). I'd be happy doing a PR for this, once the names have settled. So I'll assign this to myself.
Buried in the old categories library, I found the following gems:
Should these be added to the standard library?
The text was updated successfully, but these errors were encountered: