-
Notifications
You must be signed in to change notification settings - Fork 41
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
Remove Arbitrary? #65
Comments
I've created a branch for quickcheck without typeclasses here: https://github.com/matthewleon/purescript-quickcheck/tree/no-arbitrary It works, but needs to be made a bit friendlier. I'm going to try addressing the challenges you bring up in this post in it and see what I come up with. I'll also make some branches of libs that use quickcheck that use the aribtrary-less version to see what problems are caused and how they can be solved. |
There's also https://github.com/jystic/purescript-jack, which I think is already a fairly advanced quickcheck-style library with no |
Thanks for bringing that up. Very good points. I'll give my branch a rest then :) |
Jack is no longer maintained (AFAIK). Moreover, we added versions of |
How would you implement generic arbitrary? |
Meaning, an arbitrary for the generic representations of a type via the |
Ah... |
You could have a |
But you still need a type class for the types at the leaves of the generic representation
…Sent from my iPhone
On Dec 4, 2021, at 12:18 PM, Gary Burgess ***@***.***> wrote:
You could have a MonadGen m => Generic a => m a I think.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
I think removing the |
I don't think the need for newtypes makes |
Right - I guess what I'm saying is, if we think |
I haven't used
rather than
The first is easier to write because I don't need to provide each constructor to If I wanted the same flexibility via newtypes and On another hand, how is |
You wouldn't use |
Gotcha. Then what other newtypes would need to be added to make it possible to use |
Given the points made by @paf31 above, I think this issue should be closed and Arbitrary kept. |
I'm adding this to track the discussion going on in #63.
The argument for removing
Arbitrary
is that instances are almost never canonical, so we almost always end up needingnewtype
s.A possible downside is that we'd still need a class like
Arbitrary
if we want to derive generators usinggeneric-rep
. That means that we'd need some way to reflect aGen
as an instance, or we're back toArbitrary
instances anyway.CoArbitrary
is also much nicer with type classes.The text was updated successfully, but these errors were encountered: