12 Jan 20:33 2013

## Generating random arguments for a function

satvik chauhan <mystic.satvik <at> gmail.com>

2013-01-12 19:33:08 GMT

2013-01-12 19:33:08 GMT

I am trying to use quickcheck to generate random arguments of a given function (assuming all its types have Arbitrary instance and Show instance) along with the evaluation of the function at those arguments.

Suppose I have a function

add :: Int -> Int -> Int

add a b = a+b

Then I assume a behavior like

> randomEvaluate add

(["1","3"],"4")

where 1 and 3 are random values generated for `Int` and 4 is `f 1 3`.

I have asked this on SO but am not fully satisfied with the answers.

-Satvik

_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe <at> haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe