[Haskell-cafe] How to choose an arbitrary Arbitrary?
Bas van Dijk
v.dijk.bas at gmail.com
Thu Dec 18 04:24:31 EST 2008
On Wed, Dec 17, 2008 at 11:05 PM, Ryan Ingram <ryani.spam at gmail.com> wrote:
> ...It's possible to extend this idea and generate an "arbitrary arbitrary"...
Thanks for your thorough answer.
I like the SomeArbitrary idea. I see it's easy to also sample SomeArbitrary.
You do need to add a 'Show' constraint to the existential 'a' in SomeArbitrary.
samplesSomeArbitrary :: IO ()
samplesSomeArbitrary = mapM_ f =<< sample' arbitrary
f (SomeArbitrary a) = sample (arbitrary `asTypeOf` gen a)
gen :: a -> Gen a
gen _ = undefined
 sample: http://hackage.haskell.org/packages/archive/QuickCheck/22.214.171.124/doc/html/Test-QuickCheck.html#v%3Asample
More information about the Haskell-Cafe