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/





_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to