# Diagonalization/ dupe for monads and tuples?

Keith keith.wygant at gmail.com
Thu Sep 17 18:39:46 UTC 2020

```>If I really had my way, we’d make (,) a right-associative operator in both
>values and types, so (a, b, c) = (a, (b, c)), and accessor functions could
>work on any size of tuple.

uncurry . uncurry :: (a -> b -> c -> d) -> ((a, b), c) → d, so left-nesting may be more convenient.
—
Sent from my phone with K-9 Mail.

On September 17, 2020 5:20:04 PM UTC, Jon Purdy <evincarofautumn at gmail.com> wrote:
>I’m inclined against anything to do with higher tuples than pairs,
>honestly. If there’s a real demand for it at some point, we can certainly
>consider it, but pairs are vastly more common, and I’ve only ever wanted or
>seen people wanting the ‘a → (a, a)’ version in practice.
>
>Generally speaking, I see ≥3-tuples as a sign of a missing data type, and I
>think I’m in likeminded company here.
>
>If I really had my way, we’d make (,) a right-associative operator in both
>values and types, so (a, b, c) = (a, (b, c)), and accessor functions could
>work on any size of tuple.
>
>I would also expect these functions to be called dup, dup3, dup4, &c. by
>analogy with other tuple functions using that convention (e.g. zip, zip3).
>
>On Thu, Sep 17, 2020, 10:03 AM David Feuer <david.feuer at gmail.com> wrote:
>
>> Does dup come with trip, quadrup, etc.? It doesn't have to, but once you
>> plug one hole the others nearby start to stand out.
>>
>> On Wed, Sep 16, 2020, 1:58 PM Carter Schonwald <carter.schonwald at gmail.com>
>> wrote:
>>
>>> It was pointed out to me in a private communication that the tuple
>>> function \x->(x,x) is actually a special case of a diagonalization for
>>> biapplicative and some related structures monadicially.  Another example in
>>> the same flavor is pure impl for the applicative instance for sized lists.
>>>
>>> diag x = bipure x x
>>>
>>> So framed a litttle differently, there’s definitely an abstraction or
>>> common pattern lurking here. Perhaps folks can help Tease this out. One
>>> person I chatted with this morning alluded to it being relevant to
>>> computational flavors of adjunctions or some such ? It def matters in a
>>> different way when doing computation resource aware programming in a
>>> symmetric monoidal category.
>>>
>>> Let’s collect some ideas and patterns and get to the bottom of this!
>>> _______________________________________________
>>> Libraries mailing list