Scala view application puzzler

前端 未结 5 1657
粉色の甜心
粉色の甜心 2021-02-04 09:20

Say we have the following two traits:

trait Foo[A] { def howMany(xs: List[A]) = xs.size }
trait Bar

And an implicit conversion from the second

5条回答
  •  旧时难觅i
    2021-02-04 10:04

    Replacing your Foo with this:

    trait Foo[_] { def howMany(xs: List[_]) = xs.size }

    It works, which also makes quite a lot more sense to me because your absolutly not interested in A.

提交回复
热议问题