patch applied (packages/QuickCheck): Fix bug in variant

Ian Lynagh igloo at earth.li
Sat Sep 6 14:58:28 EDT 2008


Thu Aug 21 20:59:48 PDT 2008  Patrick Perry <patperry at stanford.edu>
  * 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


More information about the Cvs-libraries mailing list