You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thank you for your great library and great expositions! This library is really cool indeed.
Feature Request: Pure interface for Gen
Currently, there is an impure interface to sample a value from Gen:
sample::Gena->IOa
It would also be nice to have a pure analogue for this. The most straightforward one could be:
sampleFrom::SMGen->Gena->a
Unfortunately, this leaks the implementation detail. So perhaps it could be something like this:
dataGenSource-- opaque (could be just a newtype wrapper around SMGen or SampleTree)mkGenSource::Word64->GenSourcesampleFrom::GenSource->Gena->a
Background
Recently, I use falsify to test the validity of transformations on propositional formulae.
The test worked well, and I eventually have several valid implementations with different performance characteristics. So I decided to take some benchmarks on them.
To do that, I have to generate some random formula of a specific size. Surely, we can do this with sample :: Gen a -> IO a. One downside of sample function is the lack of reproducibility - as sample initialises SMGen from the air on every invocation, we don't have any access to the seed it used.
Once we have sampled some formulae from Gen, we must save them on a disk. This becomes tedious when one needs multiple formulae. If we can sample a value from specified seed, then we can just hard-code the seed instead.
The text was updated successfully, but these errors were encountered:
Yes, that absolutely seems reasonable. Perhaps the library should offer a public API that can be used to define both the tasty and the ghci interfaces, and then that would then also give applications such as the one you describe what they need. I will probably not have time for this in the next few weeks though :/
Hi,
First of all, thank you for your great library and great expositions! This library is really cool indeed.
Feature Request: Pure interface for Gen
Currently, there is an impure interface to sample a value from
Gen
:It would also be nice to have a pure analogue for this. The most straightforward one could be:
Unfortunately, this leaks the implementation detail. So perhaps it could be something like this:
Background
Recently, I use
falsify
to test the validity of transformations on propositional formulae.The test worked well, and I eventually have several valid implementations with different performance characteristics. So I decided to take some benchmarks on them.
To do that, I have to generate some random formula of a specific size. Surely, we can do this with
sample :: Gen a -> IO a
. One downside ofsample
function is the lack of reproducibility - assample
initialisesSMGen
from the air on every invocation, we don't have any access to the seed it used.Once we have sampled some formulae from
Gen
, we must save them on a disk. This becomes tedious when one needs multiple formulae. If we can sample a value from specified seed, then we can just hard-code the seed instead.The text was updated successfully, but these errors were encountered: