-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds helper to create Shrink using LazyList #627
Conversation
2378e72
to
a55c651
Compare
Awesome! I'd personally prefer this as a method directly on |
Yes, that would be the preference. Though, I don't think it's possible to have both definitions of |
b6ba502
to
e2f7c09
Compare
You are right. Although to be honest, I don't get why the compiler can not differentiate between Function1[T, Stream[T]] and Function1[T, LazyList[T]] here. I followed your suggestions (and am sorry for not looking at the codebase thoroughly before). And I renamed the function from apply to fromLazyList. Again naming is hard, not exactly accurate. Maybe fromLazyListFunction but that seems clunky. Ideas welcome. |
I believe it's because Function1 is implemented with type parameters, as well. There may be a way to overload methods having type parameters with a dummy implicit, but that seems unsavory. |
I suggested it, but maybe |
If we have a name for the Shrink factory method, instead of using |
Indeed, def apply[T](s: T => LazyList[T])(implicit d: DummyImplicit): Shrink[T] |
This allows to use Shrink from scala 2.13 without getting deprecation warnings on scala.collection.immutable.Stream
Actually DummyImplicit does not do the trick on its own, if I add the apply method with the DummyImplicit I still get a lot of errors like the following:
I therefore opted for renaming the factory method to withLazyList.
I don't have an opinion on that, as I do not know what the further plans for LazyList and scalacheck 2.0 are. I am happy to do whatever you decide ;) |
e2f7c09
to
def2403
Compare
Thanks for bearing with us and being amenable to our whims. I predict the change is pretty benign, since it's just a factory method for Shrink. It shouldn't paint us in to a corner, and more likely it should be something we can use going forward. |
No worries :) I learned something in the process, which is even dearer to me, then getting rid of those annoying warnings. |
I wish there was a way to easily dogfood this new factory in the library. Alternatively, we could add tests, but there aren't many existing example tests for Shrink nor any version-specific tests. |
Thanks again for working on this. We'll wait and see if there are other comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me :)
thanks @froth! |
This allows to use Shrink from scala 2.13 without getting deprecation
warnings on scala.collection.immutable.Stream
fixes #626