Skip to content

Instantly share code, notes, and snippets.

@odenzo
Last active May 28, 2022 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odenzo/7ad9c5f1baeb168277e0a07ce11a5843 to your computer and use it in GitHub Desktop.
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
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