Last active
August 29, 2015 14:21
-
-
Save awekuit/79f76346191488a57aa9 to your computer and use it in GitHub Desktop.
Scalaで、型シグネチャが同じcase class同士を変換する
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
case class Foo(a: Int, s: String) | |
case class Bar(a: Int, s: String) | |
val foo = Foo(100, "hey!") | |
// foo: Foo = Foo(100,hey!) | |
val bar = Bar.tupled(Foo.unapply(foo).get) | |
// bar: Bar = Bar(100,hey!) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment