Created
February 18, 2016 02:48
-
-
Save wheaties/95b65d9ccf287eb0efdb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Contains[Items]{ | |
| def apply[Obj](obj: Obj)(implicit oneOf: OneOf[Obj, Items]) = obj | |
| } | |
| val isd = new Contains[Int|String|Double] | |
| //success test cases | |
| isd(1) | |
| isd(2.0) | |
| isd("hello") | |
| //failure test case | |
| isd(true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment