simple union type
simple union type
scala> import sclib.util.union._ scala> def f[A: (Int Or String)#Check](a: A): Int = a match { | case i: Int => i | case s: String => s.length | } scala> f(5) res0: Int = 5 scala> f("hey") res1: Int = 3 // this throws a compiler error: scala> f(5L)
utilities
check the member documentation for examples