Created
February 23, 2012 14:43
-
-
Save adriaanm/1893135 to your computer and use it in GitHub Desktop.
breaking virtpatmat with skolems
This file contains 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
// exploring skolems/existentials that stem from scrutinee.tpe/unapply-type-params, | |
// and how they break virtpatmat | |
object Test { | |
object UnBounded { | |
def unapply[A](xs: UnBounded[A]): Option[A] = Some(xs.el) | |
} | |
class UnBounded[T](val el: T) | |
object Bounded { | |
def unapply[A <: Ord[A]](xs: Bounded[A]): Option[A] = Some(xs.el) | |
} | |
class Bounded[T <: Ord[T]](val el: T) | |
class Ord[T] | |
class IntO extends Ord[IntO] | |
object Exist { | |
def unapply(xs: Exist[_]): Option[_] = Some(xs.el) | |
} | |
class Exist[T](val el: T) | |
val s: PartialFunction[Any, Any] = { | |
case UnBounded(x) => x | |
case Exist(x) => x | |
} | |
abstract class I { | |
type x <: Ord[x] | |
type B = Bounded[x] | |
} | |
val t : PartialFunction[I#B, Any] = { | |
case Bounded(x) => x | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment