[Haskell-cafe] Generating random arguments for a function

satvik chauhan mystic.satvik at gmail.com
Sun Jan 13 10:47:13 CET 2013


I have a working code of this but for that I have to reimplement Arbitrary
and Testable typeclasses which I don't want to do. I thought it might be
possible to use parts of quickcheck without actually changing its code but
still I am unable to find a suitable solution.

-Satvik

On Sun, Jan 13, 2013 at 2:58 PM, Roman Cheplyaka <roma at ro-che.info> wrote:

> * Stephen Tetley <stephen.tetley at gmail.com> [2013-01-13 08:49:08+0000]
> > In general you can't do this whether you use pats of QuickCheck or not
> > - `randomEvalute` would need to inspect the supplied function to see
> > how many input parameters it has so it can list them, but there is no
> > such introspection in Haskell.
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130113/977daf10/attachment.htm>


More information about the Haskell-Cafe mailing list