caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Simon Cruanes <simon.cruanes.2007@m4x.org>
Cc: OCaml users <caml-list@inria.fr>
Subject: [Caml-list] [ANN] random-generator 0.1 (Was: [ANN] QCheck 0.1)
Date: Fri, 25 Oct 2013 16:51:23 +0200	[thread overview]
Message-ID: <CAPFanBG0hTAhHAmjrOyRCKm9Zj_4UksoO5S7fC=yog8s0+381A@mail.gmail.com> (raw)

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 ;)

             reply	other threads:[~2013-10-25 14:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-25 14:51 Gabriel Scherer [this message]
2013-10-25 15:47 ` Gabriel Kerneis
2013-10-25 15:57   ` Gabriel Scherer
2013-10-29  0:55   ` Francois Berenger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPFanBG0hTAhHAmjrOyRCKm9Zj_4UksoO5S7fC=yog8s0+381A@mail.gmail.com' \
    --to=gabriel.scherer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=simon.cruanes.2007@m4x.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).