<html><head></head><body><div><div><div style="display: none; border: 0px; width: 0px; height: 0px; overflow: hidden; visibility: hidden;"><img src="https://r.superhuman.com/3r14CnCTXU-TxCRPiwrkQu_w0cAF3YU9bv5_i65gk9voWtLnXhEx7uUH5nJscmv99rJ7HovTT1N9uHcCbXiNwxbV6V0wLMk5xh9QgslZauMhkMXYIazmUoCBJhMLUPUTA1M4i_1VsPNb0b6diXL8LsuOursIbiXXT7zwAx8P1l8sk_xOSD5EG80.gif" alt=" " width="1" height="0" style="display: none; border: 0px; width: 0px; height: 0px; overflow: hidden; visibility: hidden;"/><!-- --></div><div><div><div>Proposing the following names then to start, and we can talk about expanding this at a later date: <br/><br/>```</div><div>-- In Data.Tuple<br/></div><div>diag :: a → (a,a)<br/>diag a = (a, a)</div><div><br/>-- In Data.Either<br/>codiag :: Either a a → a<br/>codiag = either id id</div><div>```<br/></div><div><br/></div><div>Thoughts?<br/></div><div>Emily<br/><br/></div></div><br/><div class="gmail_signature"></div></div><br/><div><div class="gmail_quote">On Thu, Sep 17, 2020 at 12:55 AM, Asad Saeeduddin <span dir="ltr"><<a href="mailto:masaeedu@gmail.com" target="_blank">masaeedu@gmail.com</a>></span> wrote:<br/><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote sh-color-black sh-color" style="null" id="null"><p class="sh-color-black sh-color">`Either a a -> a` is another very handy operation. That and `a
-> (a, a)` together make up 90% of use cases for `duplicate ::
p x (t x x)`.<br/>
</p>
<div class="moz-cite-prefix sh-color-black sh-color">On 9/17/20 12:49 AM, Edward Kmett
wrote:<br/>
</div>
<blockquote cite="mid:CAJumaK8=fp8KN22QS4qggs2hWo_UuSTeiq5imsJh7isHCmq=xQ@mail.gmail.com" type="cite" class="sh-color-black sh-color">
<div dir="ltr" class="sh-color-black sh-color">For what it's worth, I'd just like to see a
no-nonsense
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color"><font face="monospace" class="sh-color-black sh-color">dup : a -> (a,a)</font></div>
<div class="sh-color-black sh-color"><font face="monospace" class="sh-color-black sh-color">dup a = (a,a)</font></div>
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color">in <font face="monospace" class="sh-color-black sh-color">Data.Tuple</font>, where it is
out of the way, but right where you'd expect it to be when
looking for something for working with tuples.</div>
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color">Yes, <font face="monospace" class="sh-color-black sh-color">bipure</font> and <font face="monospace" class="sh-color-black sh-color">id &&& id</font> exist, and
generalize it on two incompatible axes, and if we had a proper
cartesian category we'd be able to supply this in full
generality, as a morphism to the diagonal functor, but all of
these require a level of rocket science to figure out.</div>
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color">I'd also happily support adding the equivalent in <font face="monospace" class="sh-color-black sh-color">Data.Either</font> for <font face="monospace" class="sh-color-black sh-color">Either a a -> a</font>, which invites
bikeshedding names.</div>
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color">-Edward</div>
</div>
<br/>
<div class="gmail_quote sh-color-black sh-color">
<div class="gmail_attr sh-color-black sh-color" dir="ltr">On Wed, Sep 16, 2020 at 6:10
PM Emily Pillmore <<a href="mailto:emilypi@cohomolo.gy" target="_blank" rel="noopener noreferrer">emilypi@<wbr/>cohomolo.<wbr/>gy</a>> wrote:<br/>
</div>
<blockquote style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">Just to clarify, that's not the "real" diagonal
in the space, but it is a super useful translation
that I'd like for free :)</div>
</div>
<br/>
</div>
<br/>
<div class="sh-color-black sh-color">
<div class="gmail_quote sh-color-black sh-color">On Wed, Sep 16, 2020 at 9:08
PM, Emily Pillmore <span dir="ltr" class="sh-color-black sh-color"><<a href="mailto:emilypi@cohomolo.gy" target="_blank" rel="noopener noreferrer">emilypi@<wbr/>cohomolo.<wbr/>gy</a>></span>
wrote:<br/>
<blockquote style="margin:0px
0px 0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex" class="gmail_quote sh-color-black sh-color">
<div class="gmail_extra sh-color-black sh-color">
<div id="gmail-m_7220689800887981291null" class="gmail_quote sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">@Asad that's a perfectly reasonable
way to think about diagonal
operations: as the data of a cartesian
monoidal category, and the laws are
correct in this case. I think we can
get away with the additional
abstraction to `Biapplicative` in this
case, though.<br/>
</div>
<div class="sh-color-black sh-color"><br/>
</div>
<blockquote class="sh-color-black sh-color">
<div style="text-decoration:none" class="sh-color-black sh-color">
<div style="text-decoration:none" class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<p style="margin:0px" class="sh-color-black sh-color">wouldn't
the existence of
appropriate
`forall a. a ->
t a a` and `forall
a. x -> Unit t`
functions
pigeonhole it into
being "the"
cartesian monoidal
structure on
`->` (and thus
naturally
isomorphic to
`(,)`)?<br/>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color">Only if you chose that particular
unit and that particular arrow. But
there are other places where having
a general `Biapplicative` contraint
would make it useful. For example,
i'd like to use this in `smash`
with `diag :: a → Smash a a`,
defining the adjoining of a point to
`a` and creating a diagonal in the
subcategory of pointed spaces in
Hask, so that I don't have to
redefine this as `diag' = quotSmash
. view _CanIso . diag . Just`. <br/>
</div>
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color">Cheers,<br/>
</div>
<div class="sh-color-black sh-color">Emily</div>
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color"><br/>
</div>
</div>
<div class="sh-color-black sh-color"><br/>
</div>
</div>
<br/>
</div>
<br/>
<div class="sh-color-black sh-color">
<div class="gmail_quote sh-color-black sh-color">On Wed, Sep 16,
2020 at 6:35 PM, Asad Saeeduddin <span dir="ltr" class="sh-color-black sh-color"><<a rel="noopener noreferrer" href="mailto:masaeedu@gmail.com" target="_blank">masaeedu@<wbr/>gmail.<wbr/>com</a>></span>
wrote:<br/>
<blockquote class="gmail_quote sh-color-black sh-color" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div class="gmail_extra sh-color-black sh-color">
<div class="gmail_quote sh-color-black sh-color" id="gmail-m_7220689800887981291null">
<p class="sh-color-black sh-color">Whoops, I just realized I've
been responding to Carter
specifically instead of to the
list.<br/>
<br/>
I was having some trouble
understanding the `unJoin` stuff
but I read it a few more times
and I think I understand it a
little better now.<br/>
<br/>
In my personal experience the
"abstracted version" of `x ->
(x, x)` I use most often looks
like this:<br/>
<br/>
```<br/>
</p>
<pre class="sh-color-black sh-color">class SymmetricMonoidal t i p => CartesianMonoidal t i p</pre>
<pre class="sh-color-black sh-color"> where</pre>
<pre class="sh-color-black sh-color"> duplicate :: p x (x `t` x)</pre>
<pre class="sh-color-black sh-color"> discard :: p x i
</pre>
<pre class="sh-color-black sh-color">-- Laws:</pre>
<pre class="sh-color-black sh-color">-- duplicate >>> first discard = fwd lunit</pre>
<pre class="sh-color-black sh-color">-- duplicate >>> second discard = fwd runit
</pre>
<pre class="sh-color-black sh-color">-- where</pre>
<pre class="sh-color-black sh-color">-- lunit :: Monoidal t i p => Iso p x (i `t` x)</pre>
<pre class="sh-color-black sh-color">-- runit :: Monoidal t i p => Iso p x (x `t` i)</pre>
<p class="sh-color-black sh-color">```<br/>
<br/>
i.e. adding a suitable duplicate
and discard to some symmetric
monoidal structure gives us a
cartesian monoidal structure.<br/>
<br/>
This doesn't really seem to be
relevant to what you folks are
looking for, but it does bring
up a question. If some
`Bifunctor` `t` happens to form
a monoidal structure on `->`,
wouldn't the existence of
appropriate `forall a. a -> t
a a` and `forall a. x -> Unit
t` functions pigeonhole it into
being "the" cartesian monoidal
structure on `->` (and thus
naturally isomorphic to `(,)`)?</p>
<div class="sh-color-black sh-color">On 9/16/20 5:26 PM, Emily
Pillmore wrote:<br/>
</div>
<blockquote type="cite" class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">
<div class="sh-color-black sh-color">Nice! <br/>
<br/>
That's kind of what I
was going for with
Carter earlier in the
day, thanks Matthew. </div>
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color">I think a
diagonalization
function and functor
are both very sensible
additions to
`bifunctors` and
`Data.Bifunctor`. The
theory behind this is
sound: The
diagonalization
functor Δ: Hask →
Hask^Hask, forms the
center of the adjoint
triple `colim -| Δ -|
lim : Hask →
Hask^Hask`. <br/>
<br/>
Certainly the function
`diag :: a → (a,a)` is
something I've seen
written in several
libraries, and should
be included in
`Data.Tuple` as a
`base` function. The
clear generalization
of this function is
`diag :: Biapplicative
f ⇒ a → f a a`. I'm in
favor of both existing
in their separate
capacities. </div>
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color">Thoughts? <br/>
</div>
<div class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color">Emily</div>
</div>
<br/>
</div>
<br/>
<div class="sh-color-black sh-color">
<div class="gmail_quote sh-color-black sh-color">On
Wed, Sep 16, 2020 at
3:49 PM, Carter
Schonwald <span dir="ltr" class="sh-color-black sh-color"><<a href="mailto:carter.schonwald@gmail.com" rel="noopener noreferrer" target="_blank">carter.<wbr/>schonwald@<wbr/>gmail.<wbr/>com</a>></span>
wrote:<br/>
<blockquote style="margin:0px 0px
0px
0.8ex;border-left:1px
solid
rgb(204,204,204);padding-left:1ex" class="gmail_quote sh-color-black sh-color">
<div class="gmail_extra sh-color-black sh-color">
<div id="gmail-m_7220689800887981291null" class="gmail_quote sh-color-black sh-color">
<div dir="auto" class="sh-color-black sh-color">Is
the join bipure
definition
taking advantage
of the (a->)
monad instance?
Slick!</div>
<div dir="auto" class="sh-color-black sh-color"><br/>
</div>
<div dir="auto" class="sh-color-black sh-color"><br/>
</div>
<div class="sh-color-black sh-color">
<div class="gmail_quote sh-color-black sh-color">
<div dir="ltr" class="gmail_attr sh-color-black sh-color">On
Wed, Sep 16,
2020 at 3:39
PM Matthew
Farkas-Dyck
<<a rel="noopener noreferrer" href="mailto:strake888@gmail.com" target="_blank">strake888@<wbr/>gmail.<wbr/>com</a>> wrote:<br/>
</div>
<blockquote class="gmail_quote sh-color-black sh-color" style="margin:0px
0px 0px
0.8ex;border-left:1px
solid
rgb(204,204,204);padding-left:1ex">We also have<br/>
<br/>
<br/>
<br/>
diag = join
bipure<br/>
<br/>
<br/>
<br/>
and (in
pseudo-Haskell)<br/>
<br/>
<br/>
<br/>
diag = unJoin
. pure<br/>
<br/>
where<br/>
<br/>
newtype
Join f a =
Join { unJoin
:: f a a }
deriving
(Functor)<br/>
<br/>
deriving
instance
Biapplicative
f =>
Applicative
(Join f)<br/>
<br/>
<br/>
<br/>
The latter
seems on its
face
potentially
related to the
instance for<br/>
<br/>
lists of fixed
length, but i
am not sure
how deep the
connection may<br/>
<br/>
be.<br/>
<br/>
</blockquote>
</div>
</div>
<p class="sh-color-black sh-color">_______________________________________________
<br/>
Libraries
mailing list <br/>
<a href="mailto:Libraries@haskell.org" rel="noopener noreferrer" target="_blank">Libraries@<wbr/>haskell.<wbr/>org</a> <br/>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noopener noreferrer" target="_blank">http:/<wbr/>/<wbr/>mail.<wbr/>haskell.<wbr/>org/<wbr/>cgi-bin/<wbr/>mailman/<wbr/>listinfo/<wbr/>libraries</a></p>
</div>
</div>
</blockquote>
</div>
</div>
<br/>
</div>
</div>
<br/>
<fieldset class="sh-color-black sh-color"></fieldset>
<pre class="sh-color-black sh-color">_______________________________________________
Libraries mailing list
<a href="mailto:Libraries@haskell.org" rel="noopener noreferrer" target="_blank">Libraries@<wbr/>haskell.<wbr/>org</a>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noopener noreferrer" target="_blank">http:/<wbr/>/<wbr/>mail.<wbr/>haskell.<wbr/>org/<wbr/>cgi-bin/<wbr/>mailman/<wbr/>listinfo/<wbr/>libraries</a>
</pre>
</blockquote>
<p class="sh-color-black sh-color">_______________________________________________
<br/>
Libraries mailing list
<br/>
<a rel="noopener noreferrer" href="mailto:Libraries@haskell.org" target="_blank">Libraries@<wbr/>haskell.<wbr/>org</a>
<br/>
<a rel="noopener noreferrer" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank">http:/<wbr/>/<wbr/>mail.<wbr/>haskell.<wbr/>org/<wbr/>cgi-bin/<wbr/>mailman/<wbr/>listinfo/<wbr/>libraries</a></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
<br/>
</div>
</div>
</div>
_______________________________________________<br/>
Libraries mailing list<br/>
<a href="mailto:Libraries@haskell.org" target="_blank" rel="noopener noreferrer">Libraries@<wbr/>haskell.<wbr/>org</a><br/>
<a rel="noopener noreferrer" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank">http:/<wbr/>/<wbr/>mail.<wbr/>haskell.<wbr/>org/<wbr/>cgi-bin/<wbr/>mailman/<wbr/>listinfo/<wbr/>libraries</a></blockquote></div></blockquote></div></div></blockquote></div></div><br/></div></div></body></html>