beam icon indicating copy to clipboard operation
beam copied to clipboard

Add type for returning arbitrary size tuples

Open mightybyte opened this issue 5 years ago • 4 comments

The postgresql-simple library has a type :. that facilitates returning query results of arbitrary size.

https://hackage.haskell.org/package/postgresql-simple-0.6.2/docs/Database-PostgreSQL-Simple.html#t:Only

(I didn't link to :. because GitHub doesn't handle it properly)

Could something similar be added to beam? I'm not stuck on :. as the operator. Servant has a :. operator that conflicts, so I'm open to anything. But the convenience would be really nice.

mightybyte avatar Mar 24 '20 17:03 mightybyte

You should effectively be able to do this already by nesting tuples. @mightybyte Are there any benefits to a specific type for this that I'm missing?

kmicklas avatar Aug 31 '20 22:08 kmicklas

Nesting tuples is just a pain. Also, when I was playing with it I believe there was a mismatch between the size of tuples that were actually supported compared with what the documentation said. An operator like this is purely for convenience.

mightybyte avatar Sep 03 '20 02:09 mightybyte

Yeah, I guess having an operator with associativity is nice because you don't have to write out the nesting structure. PRs welcome!

kmicklas avatar Sep 03 '20 12:09 kmicklas

Is there a library that provides this type? It seems like something that doesn't need to be rebuilt.

3noch avatar Sep 04 '20 16:09 3noch