simulacrum icon indicating copy to clipboard operation
simulacrum copied to clipboard

Type mismatch when generating instances for `F[G[_]]`

Open Twizty opened this issue 6 years ago • 0 comments

Hi, I've been working on the issue at cats (https://github.com/typelevel/cats/issues/3141), and have found strange behavior of simulacrum. I've implemented a method def foldA[G[_], A](fga: F[G[A]])(implicit G: Applicative[G], A: Monoid[A]): G[A] for Foldable and it's compiled to def foldA[G[_], A](implicit ev$macro$49: <:<[D, G[A]], G: Applicative[G], A: Monoid[D]) = typeClassInstance.foldA(self.asInstanceOf[F[G[A]]])(G, A); which fails with this error:

type mismatch;
found   : cats.Monoid[D]
   (which expands to)  cats.kernel.Monoid[D]
required: cats.Monoid[A]
   (which expands to)  cats.kernel.Monoid[A]
@typeclass trait Foldable[F[_]] extends UnorderedFoldable[F] { self =>
^

Is it a bug or am I doing something wrong?

Twizty avatar Nov 14 '19 18:11 Twizty