The politicism of subtypes allows us to pass values โโof a certain type or any of its subtypes into a method. If the method takes a value like Fruit, we can also pass Apple inside (an apple is a fruit after all). Therefore, if you want to pass Mappable.MappableOption to your bananaTuple method, you must make this MappableOption a subtype of MappableSome (since the type of your first bananaTuple parameter is implicit). This means that you want your comparable contravariant (if Some <: Option , then Mappable[Some] >: Mappable[Option] ).
But you cannot have Mappable[F[_]] contravariant in F, because F appears in the covariant map position (as a function parameter). Note that F also appears in the contravariant position of map (as a return value).
If you manage to make Mappable[F[_]] contravariant in F, it should work, but I'm not sure if making it contravariant makes sense. That is, if you want a subtype relation, such as, for example, Apple <: Fruit will result in Mappable[Apple] >: Mappable[Fruit] (this will not compile since Apple and Fruit are not type constructors, but I just use simple types to do here).
Creating a type of contravariance in its type and solving the problem of a contravariant type appearing in a covariant position is a common problem, and perhaps better if you look for it elsewhere ( here is one example). I still think it's better to provide an implicit object for each type that you want to use, that is, provide separate implicit objects, for example. Seq and List .
slouc source share