[Haskell-cafe] Generating random arguments for a function

Bob Ippolito bob at redivi.com
Sun Jan 13 16:34:06 CET 2013


I think it's more complicated because he doesn't know what the return type
or arity of the function is. In QuickCheck they know the return type of a
property is Bool. In this case, we only know that the return type is an
instance of Show. I don't think that's enough to simply implement this.

On Sunday, January 13, 2013, Stephen Tetley wrote:

> Yes - I was just checking the first QuickCheck paper to see how the
> authors did this.
>
> You would need a new type class that works like `Testable` and the
> versions of associated machinery `forAll` and `evaluate` to unroll
> function application.
>
>
> On 13 January 2013 09:28, Roman Cheplyaka <roma at ro-che.info <javascript:;>>
> wrote:
>
> >
> > This can be done with relatively simple type class hackery. In fact,
> > QuickCheck already does that in order to generate arguments and print
> > them in case of failure.
> >
> > Roman
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org <javascript:;>
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130113/4e3d7e63/attachment.htm>


More information about the Haskell-Cafe mailing list