blob: 030de0f849aa5d07c2805b1391312f6583db02f1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
|
enum class List[+T]
object List {
case Cons(x: T, xs: List[T])
case Nil extends List[Nothing]
}
object Test {
import List._
val xs = Cons(1, Cons(2, Cons(3, Nil)))
def main(args: Array[String]) = println(xs)
}
|