Skip to content
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

Make Gen.eval easier to use in v3 #268

Closed
moodmosaic opened this issue May 22, 2016 · 5 comments
Closed

Make Gen.eval easier to use in v3 #268

moodmosaic opened this issue May 22, 2016 · 5 comments
Labels

Comments

@moodmosaic
Copy link
Contributor

Currently, the type signature of Gen.eval is

int -> StdGen -> Gen<'a> -> 'a

Where int stands for size, StdGen for an instance of Random, and Gen<'a> for the generator we want to evaluate.

I believe that StdGen shouldn't be exposed, as it's really an implementation detail, and so Gen.eval should look like:

int -> Gen<'a> -> 'a

Where int stands for size, and Gen<'a> for the generator we want to evaluate.


If Runner uses Gen.eval for test-replaying, that could be done via some other function, probably internal, or hidden.

Related: #267, #236, #198.

@Aaronontheweb
Copy link

I second this - would help a lot with an FsCheck integration I'm working on designed to make it much easier to use with C# POCO classes (including fun edge cases like constructor arguments, etc...). Being able to access the same StdGen instance as the Runner or not having to worry about it period would be great.

@moodmosaic
Copy link
Contributor Author

moodmosaic commented Dec 13, 2016

Actually, I think that making Gen.eval public wasn't a good idea at all, since there's Gen.sample...

@ploeh
Copy link
Member

ploeh commented Dec 13, 2016

Isn't Gen.eval deterministic?

@moodmosaic
Copy link
Contributor Author

moodmosaic commented Dec 13, 2016

True. Gen.sample uses Gen.eval internally. And Gen.eval takes the seed as argument so it's an easy way to replay a test... I've updated my comment above.

kurtschelfthout added a commit that referenced this issue Sep 1, 2017
kurtschelfthout added a commit that referenced this issue Sep 2, 2017
@moodmosaic
Copy link
Contributor Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants