Re: [Haskell-cafe] Generating random arguments for a function

2013-01-13 Thread Stephen Tetley
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. ___

Re: [Haskell-cafe] Generating random arguments for a function

2013-01-13 Thread Roman Cheplyaka
* Stephen Tetley stephen.tet...@gmail.com [2013-01-13 08:49:08+] 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

Re: [Haskell-cafe] Generating random arguments for a function

2013-01-13 Thread Stephen Tetley
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

Re: [Haskell-cafe] Generating random arguments for a function

2013-01-13 Thread satvik chauhan
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,

Re: [Haskell-cafe] Generating random arguments for a function

2013-01-13 Thread Bob Ippolito
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

Re: [Haskell-cafe] Generating random arguments for a function

2013-01-13 Thread Joachim Breitner
Hi, Am Sonntag, den 13.01.2013, 07:34 -0800 schrieb Bob Ippolito: 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

[Haskell-cafe] Generating random arguments for a function

2013-01-12 Thread satvik chauhan
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