
Dominic Steinitz wrote:
I want to say something like:
instance Arbitrary Foo where arbitrary = choose (Foo 1, Foo 5)
but the "random" values are generated by my own random number generator not the standard one.
Does that make sense? The reason I'm trying to do this is I am generating random test data but some of it needs to be predictable It makes sense, but its not possible. The "generate" function has the type:
*generate* :: Int http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Int.html#t%3... -> StdGen http://www.haskell.org/ghc/docs/latest/html/libraries/random/System-Random.h... -> Gen http://www.haskell.org/ghc/docs/latest/html/libraries/QuickCheck/Test-QuickC... a -> a Unfortunately for your purpose you would need: *generate* :: (RandomGen g) => Int http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Int.html#t%3... -> g -> Gen http://www.haskell.org/ghc/docs/latest/html/libraries/QuickCheck/Test-QuickC... a -> a Take a look at SmallCheck. It might be more suited to your requirement anyway. Paul.