Thu Aug 21 20:59:48 PDT 2008 Patrick Perry <[EMAIL PROTECTED]>
* Fix bug in variant
Currently, "variant" will throw an execption if given a negative argument.
Moreover, the runtime of variant is linear in the argument. Both of these
issues manifest in the following properties, which will either hang or
throw an exception, depending on the platform:
\begin{code}
import Test.QuickCheck
import Text.Show.Functions
prop_ok (f :: Double -> Double) =
f (-5.5) `seq` True
prop_bug (f :: Double -> Double) =
f (-5.6) `seq` True
main = do
putStr "prop_ok:\t" >> quickCheck prop_ok
putStr "prop_bug:\t" >> quickCheck prop_bug
\end{code}
This patch backports the version of variant in QuickCheck2. It avoids the
negativity problem and makes the run-time logarithmic in the size of the
argument.
M ./Test/QuickCheck.hs -2 +7
View patch online:
http://darcs.haskell.org/packages/QuickCheck/_darcs/patches/20080822035948-cb512-da191019fa65759ae0afe6dad85fb434cb78dc63.gz
_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries