[Haskell-beginners] QuickCheck with monadic IO
Hartmut
hartmut0407 at googlemail.com
Fri Aug 12 23:31:58 CEST 2011
Everyone,
I want to run an QuickCheck on "a most simple" IO monad.
When I compile and run :main, it says:
....................................................................................................+++
OK, passed 100 tests.
Well, thats fine, since *1 mapped on any Int gives the same Int back.
But it lasts 10 seconds (!) for doing those 100 Tests.
Something must be wrong?!
I'd appreciate your ideas.
Hartmut
module MonadicQuickCheck where
import IO
import Random
import Test.QuickCheck
import Test.QuickCheck.Monadic
main = do
quickCheck x
x :: Property
x = monadicIO $ do
a <- pick arbitrary
pre $ not(null a)
b <- run $ testfunction a
assert $ b == a
testfunction :: [Int] -> IO [Int]
testfunction x = do
putStr "."
return $ map (*1) x
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110812/ecbc2db5/attachment.htm>
More information about the Beginners
mailing list