
4 Apr
2007
4 Apr
'07
11:47 a.m.
I got this simple example working so I think I have my question answered. Now I just have to learn to write generators of my own to produce valid and invalid input for my parser. module Foo where import Control.Monad import System.Random import Test.QuickCheck data Foo = Foo Int | Bar | Baz deriving Show instance Arbitrary Foo where coarbitrary = undefined arbitrary = oneof [ return Bar , return Baz , liftM Foo arbitrary ] gen' rnd = generate 10000 rnd $ vector 5 :: [Foo] gen = do { rnd <- newStdGen ; return $ gen' rnd } -- http://wagerlabs.com/