blob: f138c78be50e0920c2c464fad6048b9e620eb357 (
plain) (
tree)
|
|
class TypeConstructor {
type TypeArg
}
trait List[+T] extends TypeConstructor { type TypeArg <: T }
trait Set[T] extends TypeConstructor { type TypeArg <: T }
object obj extends List[Number] with Set[Exception] {
val x: TypeArg = ???
val n: Number = x
val e: Exception = x
}
class Functor[F <: TypeConstructor] {
def map[A, B](f: F { type TypeArg <: A }): F { type TypeArg <: B }
}
implicit object ListFunctor extends Functor[List] {
def map[A, B](f: List[A]): List[B] = ???
}
|