diverging implicit expansion

Viewed 366

Can someone please explain to me why I get a 'diverging implicit expansion error' here? I think it has to do with the type synonym type MyIdType = String but I am not sure why.

import org.scalacheck.Arbitrary
import org.scalacheck.Arbitrary._
import org.scalacheck.Gen

def arbitraryCaseClass[A,C](f: A => C)(implicit t: Arbitrary[A]): Arbitrary[C] = Arbitrary(for(v <- arbitrary[A]) yield f(v))

type MyIdType = String

implicit val arbMyIdType: Arbitrary[MyIdType] = Arbitrary(Gen.identifier)

case class Foo(s: MyIdType, t: Int)

implicit def arbA = arbitraryCaseClass((Foo.apply _).tupled)

val foo = arbitrary[Foo].sample

error:

Error:(13, 40) diverging implicit expansion for type org.scalacheck.Arbitrary[(A$A6.this.MyIdType, Int)]
starting with method arbTuple2 in trait ArbitraryArities
implicit def arbA = arbitraryCaseClass((Foo.apply _).tupled)
0 Answers
Related