Last active
May 28, 2022 12:29
-
-
Save odenzo/7ad9c5f1baeb168277e0a07ce11a5843 to your computer and use it in GitHub Desktop.
Scala 3: Extrating case class params for use as Function Arguments Tuple.fromProductTyped
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cass class MyCmd(a:Int, b:String, c:D) | |
def myFunction(a:Int, b:X, c:D) | |
val a = MyCmd(12, "Y", D.default) | |
val tupledCmd = Tuple.fromtProductTyped(a) // Will keep length and type data | |
myFunction.tupled(typledCmd) | |
To deal with mismatch of arge can add things to the tuple or partially apply the function before tupling |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment