5 ms·
Out of curiosity, is that piece of code necessary? Is there no better way to condense that? I'm a beginner with Scala, so I have no clue on that front.
by Bahamut 13y ago
Out of curiosity, is that piece of code necessary? Is there no better way to condense that? I'm a beginner with Scala, so I have no clue on that front.
- lmm 13y agoWell, that code exists at all for compatibility with tuples, which are a misfeature from the early days of scala. The "right" way to solve the problem is with shapeless' HLists. With HList you could write a simple generic method that would work with a HList of any length. (If you don't need to join a bunch of hetrogenously-typed futures while preserving all their type distinctions then you could just use the method that takes a Seq, above in the file) (You could also generate exactly this code with macros, which were a new feature in scala 2.10; I imagine a newer version of the code will do that)
- saryant 13y agoThere are some similar ugly workarounds of that nature in Play's JSON macros. Quite ugly but also transparent to anyone not writing library code.
- smrtinsert 13y agoI'm surprised you can't map over tuple members and join. Should be a one liner, but I'm a scala newbie though. Tupled were an unnecessary choice here. Pointing to this kind of stuff as an example of scala shows a complete misunderstanding of the language quite honestly.
- CCs 13y agoThat is a library code, not something you would write (or try to understand) normally.