Can someone explain why the following doesn't compile? I want that BB[A]
is also a List[A]
. The method body only enforces this view.
scala> def x[A, BB[_] <: List[_]](p: BB[A]) {p: List[A]}
<console>:8: error: type mismatch;
found : BB[A]
required: List[A]
def x[A, BB[_] <: List[_]](p: BB[A]) {p: List[A]}
^
I think you need to name the _ parameter.
scala> def x[A, BB[X] <: List[X]](p: BB[A]) {p: List[A]}
works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With