etaty/scalacheck-magnolia

Example in README not working?

DanielaSfregola opened this issue · 5 comments

Hi @etaty,
thanks for this awesome library! One of my open source projects is heavily based on scalacheck-shapeless: I am rewriting it using scalacheck-magnolia to see if it can benefit from the performance improvements.

However, not even the example shown in the README seems to work:
val arbitraryExample = implicitly[Arbitrary[Example]]
doesn't manage to actually generate an instance of arbitrary.

I have written a test about it, you can have a look here - maybe I forgot some dependency or setting while copying things over....?

Also, do you have any plans to publish this library? I know it is only 2 files, but for maintainers using your library as dependency is not ideal because it would be more difficult to upgrade to a newer version or include any bug fixes.

Cheers,
D.

etaty commented

Hi @etaty,
thanks! Moving the case class outside the spec fixes the problem....any idea why this happens?

It was working with shapeless....so...I guess it's a limitation of magnolia....?

Anyway...thanks for the suggestion! Closing this ticket

@DanielaSfregola Yes, I think it's a limitation of the current binary-release version of Magnolia. This bug has been fixed now, I believe. I'm hoping to cut a new release in the next couple of days...

By the way, the next release will also offer a way to generate code without Magnolia being a runtime dependency. Currently that's not the case.