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%3AInt> -> StdGen <http://www.haskell.org/ghc/docs/latest/html/libraries/random/System-Random.html#t%3AStdGen> -> Gen <http://www.haskell.org/ghc/docs/latest/html/libraries/QuickCheck/Test-QuickCheck.html#t%3AGen> 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%3AInt> -> g -> Gen <http://www.haskell.org/ghc/docs/latest/html/libraries/QuickCheck/Test-QuickCheck.html#t%3AGen> a -> a Take a look at SmallCheck. It might be more suited to your requirement anyway. Paul.