Skip to content

Instantly share code, notes, and snippets.

@ottomata
Last active February 27, 2018 22:03
Show Gist options
  • Save ottomata/0affe6aef7881591e1e23ed292b18b4d to your computer and use it in GitHub Desktop.
Save ottomata/0affe6aef7881591e1e23ed292b18b4d to your computer and use it in GitHub Desktop.
def f1(s1: String, s2: String, s3: String) = println(s"f1: $s1, $s2, $s3")
def f2(s1: String, s2: String) = println(s"f2: $s1, $s2")
case class Bigger(
s1: String = "AAAA",
s2: String = "AAAA",
s3: String = "AAAA"
)
case class Smaller(
s1: String = "AA",
s2: String = "AA"
)
val bigger = Bigger()
val smaller = Smaller()
// works
(f1 _).tupled(Bigger.unapply(bigger).get)
// works
(f2 _).tupled(Smaller.unapply(smaller).get)
// what I want to do is Call f2 with an instance of Bigger,
// dropping extra properties at the end.
(f2 _).tupled(Bigger.unapply(bigger).get)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment