[Haskell-cafe] QuickCheck Arbitrary - infinite recursion on recursive GADTs?
example: data A = A INt | B [A] instace Arbitrary A where arbitrary = oneof [ liftM A arbitrary , liftM B arbitrary ] But now QuickCheck will propably create a test value A ( B [ A ( B [ A - no end Is there an easy QuickCheck way to prevent this? I can think of: a) using sized to pass when to stop (decrement the value ..) b) using some type hackary data Recursive a = R a then use arbitrary :: R ( R ( a )) and remove one R each time.. c) pass a recursion indicator manually and decrement that... Which would you choose? Marc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] QuickCheck Arbitrary - infinite recursion on recursive GADTs?
Marc Weber wrote: data A = A INt | B [A] instace Arbitrary A where arbitrary = oneof [ liftM A arbitrary , liftM B arbitrary ] But now QuickCheck will propably create a test value A ( B [ A ( B [ A - no end Is there an easy QuickCheck way to prevent this? There are two successive sections in the QuickCheck manual that cover exactly this topic. http://www.cs.chalmers.se/~rjmh/QuickCheck/manual_body.html#15 b ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe