Created
January 20, 2020 04:24
-
-
Save emmettna/40de8666d3ed8f26bdd5a74a29ad7c1a to your computer and use it in GitHub Desktop.
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
final case class DummyCaseClass(value: Int) | |
val dummyCaseClassOpt = Option(DummyCaseClass(1)) | |
dummyCaseClassOpt match { | |
case Some(DummyCaseClass(v)) => v.toString | |
case Some(_) => ??? | |
case None => ??? | |
} | |
// equivalent | |
dummyCaseClassOpt match { | |
case v: Some[DummyCaseClass] => v.toString | |
case v: Some[_] => ??? | |
case None => ??? | |
} | |
// similar. But why would you ? | |
if (dummyCaseClassOpt.isInstanceOf[Some[IntegerParser]]) "1" else ??? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment