caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] [ANN] random-generator 0.1 (Was: [ANN] QCheck 0.1)
@ 2013-10-25 14:51 Gabriel Scherer
  2013-10-25 15:47 ` Gabriel Kerneis
  0 siblings, 1 reply; 4+ messages in thread
From: Gabriel Scherer @ 2013-10-25 14:51 UTC (permalink / raw)
  To: Simon Cruanes; +Cc: OCaml users

Simon's recent random-testing library release motivated me to finally
document and release a tiny library that had been collecting dust for
a few months now.

https://github.com/gasche/random-generator
http://gasche.github.io/random-generator/doc/Generator.html

random-generator is trying to answer the following question:
  "What is an elegant interface for random value generation?"

The focus is to get a combinator library where small, composable
combinators are composed to express rich behaviors. I tried hard to
choose type definitions that avoid duplication of concerns between the
various aspects of the library, building domain-specific notions of
random generation on top of a simple base layer in a modular way.

(Note that this focus is sometimes in tension with providing
convenient, derived functions that make user's code short and easy to
read. For now, random-generator will choose the "nice for the library
designer" way, and code may require some time learning the library to
be easy to read. You have been warned.)

The library currently provides three different pieces:

- a type ('a gen) for simple random generation
- a type ('a backtrack_gen) for generators that can fail:
  "generate a value such that this (possibly empty) condition is verified"
- a type ('a fueled) for generation of values with an inductive
  (tree-like) structure that looks nice to the human eye;
  see the documentation for more information on this:

    http://gasche.github.io/random-generator/doc/Generator.html#2_fueledgenerators

I consider the value of this library to be in its interface, not
necessarily its implementation. I think the current interface is solid
(though it can still be improved) and encourage people writing random
generators to steal and reuse it -- or at least feel inspired by it.


Closing remark: This design experiment started from Xavier Clerc's
inspiring Kaputt library ( http://kaputt.x9c.fr/ ), that got me
interested in random testing a few years ago. I have found random
testing to be very useful for various kind of projects
(random-generator was used to build a term generator for this year's
ICFP contest in a matter of minutes), and would encourage anyone to
consider using it to find the obvious bug in any fresh code
manipulating non-trivial data structures.

On Mon, Oct 7, 2013 at 10:35 AM, Simon Cruanes
<simon.cruanes.2007@m4x.org> wrote:
>
> Hello,
>
> I'm happy to announce the first release of a small QuickCheck
> implementation for OCaml, named `QCheck`. It consists in writing
> invariants as function t -> bool for some type t, and then checking that
> the invariant holds on randomly generated instances of t.
>
> QCheck is designed so that writing tests is as easy as possible[1],
> especially for Arbitrary instances (the part where you generate random
> values of a type) where it provides many combinators.
>
> The library requires OCaml >= 4.00.1, and is available under the BSD
> license on opam via:
>
>     $ opam install qcheck
>
> You can find documentation at:
> http://cedeela.fr/~simon/software/qcheck/QCheck.html
> source code at:
> https://github.com/c-cube/qcheck
> and some explanations here:
> http://cedeela.fr/quickcheck-for-ocaml.html
>
> Feedback or comments welcome!
> Cheers,
>
> --
> Simon
>
> [1] your mileage might vary ;)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-29  0:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-25 14:51 [Caml-list] [ANN] random-generator 0.1 (Was: [ANN] QCheck 0.1) Gabriel Scherer
2013-10-25 15:47 ` Gabriel Kerneis
2013-10-25 15:57   ` Gabriel Scherer
2013-10-29  0:55   ` Francois Berenger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).