[Haskell-cafe] Type System vs Test Driven Development

Ketil Malde ketil at malde.org
Wed Jan 12 14:05:52 CET 2011


Serge Le Huitouze <serge.lehuitouze at gmail.com> writes:

> So, do you have any "methodology" for such use cases?

QuickCheck has the ==> operator, which lets you add a precondition.  So
you could limit the testing of your property to values that satisfy the
precondition.

An alternative is to use newtype with a custom generator to produce only
data that makes sense.

Of course, ideally you should design your types so that all possible
values are meaningful :-)

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants



More information about the Haskell-Cafe mailing list