[Haskell-beginners] quickCheck generation question

Christian Maeder Christian.Maeder at dfki.de
Mon Oct 10 15:26:26 CEST 2011


Am 08.10.2011 01:40, schrieb Joe Van Dyk:
> I'm going through the 99 Haskell problems and am trying to write
> quickCheck properties for each one.
>
> -- 3 (find k"th element of a list)
> element_at xs x = xs !! x
> prop_3a xs x = (x<  length xs&&  x>= 0) ==>  element_at xs (x::Int) ==
> (xs !! x::Int)

The definition and test look very similar (basically "=" is replaced by 
"=="). So this seems to test reliability of definitions and Eq 
instances. Such tests should not be necessary. (Testing different 
implementations for equality makes more sense.)

Cheers Christian



More information about the Beginners mailing list