Skip to content

Instantly share code, notes, and snippets.

@wheaties
Created February 18, 2016 02:48
Show Gist options
  • Select an option

  • Save wheaties/95b65d9ccf287eb0efdb to your computer and use it in GitHub Desktop.

Select an option

Save wheaties/95b65d9ccf287eb0efdb to your computer and use it in GitHub Desktop.
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