ChocPanda / scalacheck-magnolia

Scalacheck Arbitrary type class derivation using magnolia
Apache License 2.0
10 stars 6 forks source link

Request to separate semi-auto vs auto derivation #192

Closed bjhartin closed 1 year ago

bjhartin commented 1 year ago

Would you consider providing a non-implicit gen for semiauto derivation, e.g.

// Traditional behavior, auto-derivation
import org.scalacheck.magnolia.auto._

and

// Semi-auto derivation (gen not implicit and renamed)
import org.scalacheck.magnolia.semiauto._

case class Foo(...)
object Foo {
  // deriveArbitrary is just a non-implicit version of gen
  // like circe, caches result to save compile time and give predictable behavior
  implicit val arbFoo: Arbitrary[Foo] = deriveArbitrary[Foo]  
}

I think this is just a couple lines of change. This solves two problems I've seen:

bjhartin commented 1 year ago

Closing in favor of spotify's magnolia/scalacheck integration.