How can I do CodeUnitTestFirst with QuickCheck? This has been running around in my head lately, I'm not sure how to approach it. Any UnitTest gurus want to contribute some ideas? --ShaeErisson HUnit is your friend. Well yes, I'm using HUnit, but... can it be done as well with QuickCheck? If not, why not? If yes, can I see an example? I've figured it out. This lets me define a 'unit' property, ( unit testing. hm. ) that I can use to see if QuickCheck can generate the type at all. If it can generate the type I can keep going. If not, make an instance of Arbitrary, and write prop_TypeName 'unit' tests for each type this type requires. -- can we generate String? prop_String :: String -> Bool prop_String x = x == x For unification types, I've found I can start with a single item in the list for oneof to choose from, and continue from there. It's like applying lazy evaluation to writing QuickCheck tests. This Ty type is from Core.hs, GHC's External Core langage. Ty has more types than this, but this is what I can test so far. -- now we can do Ty instance Arbitrary Ty where arbitrary = oneof [liftM Tvar arbitrary, liftM2 Tapp arbitrary arbitrary, liftM2 Tforall arbitrary arbitrary] coarbitrary n = error "not implemented" Ideas, thoughts, comments? --ShaeErisson It's funny, I don't remember writing the above at all, but I must have... In any case, I've hacked QuickCheck to save failing test cases and sent the diffs to the maintainers, so sometime soon purely functional test driven development should be just as easy as OOP TDD. --ShaeErisson