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

generator for functions #64

Open
fredldh opened this issue Apr 3, 2018 · 3 comments
Open

generator for functions #64

fredldh opened this issue Apr 3, 2018 · 3 comments

Comments

@fredldh
Copy link

fredldh commented Apr 3, 2018

I was wondering if there is a good way to generate random members of inductive types whose constructor may contain arrows (like bind operator in Monad.) It may be helpful for generating random programs if there is a default generator for such types including functions.

@Lysxia
Copy link
Contributor

Lysxia commented Apr 3, 2018

The best solution for QuickChick is probably to imitate Haskell QuickCheck with a splittable PRNG. The missing piece is an actual implementation of a splittable PRNG that would go right here instead of abusing OCaml's stateful semantics. There's actually some code that's already written to generate functions (CoArbitrary.v) if we solve that.

I have a branch using pringo but I haven't had the time to figure out ocaml/coq packaging.

@liyishuai
Copy link
Collaborator

I read it as generating a random instance of type A -> B.
This can be derived from a default value B and a list of key-value pairs list (A * B), which we can already generate.
I am trying to implement it here (incomplete).

@Lysxia
Copy link
Contributor

Lysxia commented Apr 3, 2018

CoArbitrary is also meant to generate functions, with better coverage and performance than key-value pairs when the domain A is large.

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

No branches or pull requests

3 participants