blob: 1fbb82ac1e602c8135b5fee104046f2d82ff6087 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
case class LazyList[T](headThunk: () => T, tailThunk: () => LazyList[T]){
lazy val head = headThunk()
lazy val tail = tailThunk()
}
object ~: {
def unapply[T](x: LazyList[T]) = Some((x.head, x.tail))
}
object MinimizedMatchFail {
val ll = LazyList(() => 1, () => LazyList(() => 2, () => ???))
ll match {
case lb ~: rest => println("success")
}
}
|