Are there languages that have first class associative product / sum types? ie ((a,b),c) = (a,(b,c)) = (a, b, c)
a|(b|c) = (a|b)|c = a|b|c
Conversation
Sum types: Typescript, Flow, Ceylon, Dotty
Product types: Not sure - afaik, Idris, Agda, and Lean's sum types associate to the right only
1
1
I dunno, associative sums would be kind of hard to work with if they were positional only. Row polymorphism + union operator could work.
2
woops: s/sums/products/
2
Oh, and that would be the intersection operator, not union. You could think of Flow and Typescipt's `(&)` over objects as being assocative.
1
({l1:T1} & {l2:T2}) & {l3:T3} = {l1:T1} & ({l2 : T2} & {l3 : T3})
1
Depends on desugaring of tuples: Idris desugars to nested pairs, where as SML desugars to numbered fields. Add `(&)` to SML then you have it

