cats icon indicating copy to clipboard operation
cats copied to clipboard

Scala 3: Support `mapN` for tuples greater than 22

Open hearnadam opened this issue 7 months ago • 3 comments

It seems the code could just be generated by version.

https://github.com/typelevel/cats/blob/b0d0475b39805bc4ec40801100442f8b60c7dded/project/Boilerplate.scala#L56

hearnadam avatar May 16 '25 23:05 hearnadam

I'm not strictly opposed. But first: increase it to what, and why not one more than that?

rossabaker avatar May 17 '25 01:05 rossabaker

It should be possible to support for any size tuple in a generic way

joroKr21 avatar May 17 '25 06:05 joroKr21

Hello, I have implemented some of these in a application via extension methods and macros: https://github.com/TheDrawingCoder-Gamer/yaoigen/blob/master/yaoigen/shared/src/main/scala/gay/menkissing/yaoigen/util/catsextras.scala

I have implemented parTupled, tupled, mapN, and parMapN. This implementation is based off of spotted-lepoards implemention, but with the types slightly changed so inference works in extensions.

Edit: this likely wouldn't actually work because f is a Tuple => R, not a normal function, so if you wanted behavior to be consistent you'd need TupledFunction which is experimental

TheDrawingCoder-Gamer avatar Nov 03 '25 16:11 TheDrawingCoder-Gamer