From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 7F90D7EE25 for ; Fri, 25 Oct 2013 16:52:05 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=74.125.83.46; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 74.125.83.46 as permitted sender) identity=mailfrom; client-ip=74.125.83.46; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ee0-f46.google.com) identity=helo; client-ip=74.125.83.46; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-ee0-f46.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqcDADGEalJKfVMulGdsb2JhbABZFoMpVK9TjitLgRoIFg4BAQEBBwsLCRIqgiUBASwZARsRDAEDEhANUAERAQUBIhOHdAEDDw2aaIxWgwqELQoZJw1kiQEBBQyPR4QzA5gKgS+ObBgphFM6 X-IPAS-Result: AqcDADGEalJKfVMulGdsb2JhbABZFoMpVK9TjitLgRoIFg4BAQEBBwsLCRIqgiUBASwZARsRDAEDEhANUAERAQUBIhOHdAEDDw2aaIxWgwqELQoZJw1kiQEBBQyPR4QzA5gKgS+ObBgphFM6 X-IronPort-AV: E=Sophos;i="4.93,570,1378850400"; d="scan'208";a="31886640" Received: from mail-ee0-f46.google.com ([74.125.83.46]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 25 Oct 2013 16:52:04 +0200 Received: by mail-ee0-f46.google.com with SMTP id c1so2020415eek.5 for ; Fri, 25 Oct 2013 07:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc:content-type; bh=4I/+mRvjYbJrFi1JorcZsHHZnRIFFepNr8tZSDZ4wpE=; b=JC6i3c+TxbePfAapP2Il/TmWHMT1K5s2WKmKumZ6BYvDVCU92uAdkFMyceTTXH0w8a xV8SAjNvNH9MZc9M8+rvu7M+UDP2w9OBtC/zDZhDFl6uKlw9u0bxvpQBIDrsjVyv4Au2 1EThllNZCMygJK8XtINTd6R6uSfIk8u0ox8Hj2ouQ+QWlR08/OuRoenBam78Y9XLL6XQ fSnOXdw4aLgLYx7N+9k8yEKCHG5gt8/7uGZRGNHr7JFMniwsV0AdjYXcEIGNHxTaSJKd rBCMpLxkv57pg1g/f9oEdeHN13fH8OCimzA2XL6gALi7q7uG4z/yrjx1NfWKR1PUJ4cH YM2g== X-Received: by 10.205.37.10 with SMTP id tc10mr768268bkb.9.1382712724159; Fri, 25 Oct 2013 07:52:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.122.72 with HTTP; Fri, 25 Oct 2013 07:51:23 -0700 (PDT) From: Gabriel Scherer Date: Fri, 25 Oct 2013 16:51:23 +0200 Message-ID: To: Simon Cruanes Cc: OCaml users Content-Type: text/plain; charset=ISO-8859-1 Subject: [Caml-list] [ANN] random-generator 0.1 (Was: [ANN] QCheck 0.1) 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 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 ;)