Hello,
Say I have this code:
import cats.Monad
import cats.implicits._
trait Test[T] {
type V
type M[_]
def value: V
def monad: Monad[M]
}
given test[T]: Test[T] with {
type V = Int
type M[_] = List[_]
def value = 1
def monad = summon[Monad[List]]
}
The def monad
in the given instance will result in an error saying that:
Found: (cats.implicits.catsStdInstancesForList : cats.Traverse[List] & (
cats.Alternative[List]
& (cats.Monad[List] & (cats.CoflatMap[List] & cats.Align[List]))))
Required: cats.Monad[test.this.M]
while the M is actually just List. Why does this doesn’t work with the type member that has kind * -> *
? And how should I solve it?
Thank you.