*Main> quickCheck prop_sorted *** Failed! Falsified (after 6 tests and 4 shrinks): [0,-1] *Main> quickCheck prop_quick_sort +++ OK, passed 100 tests. *Main> prop1 [3, 5, 1,2 ] False *Main> quickCheck prop_quick_sort *** Failed! Exception: 'Prelude.tail: empty list' (after 1 test): [] *Main> prop1 [] *** Exception: Prelude.tail: empty list *Main> quickCheck prop_quick_sort +++ OK, passed 100 tests; 16 discarded. *Main> :t arbitrary arbitrary :: Arbitrary a => Gen a *Main> :t generate generate :: Gen a -> IO a *Main> generate (arbitrary :: Gen Integer) -26 *Main> generate (arbitrary :: Gen String) "\r" *Main> generate (arbitrary :: Gen String) "'1Mo\SYN\170244\1064495Q\DC3" *Main> :t choose choose :: random-1.1:System.Random.Random a => (a, a) -> Gen a *Main> generate (choose (1, 2) :: Gen Int) 1 *Main> generate (choose (1, 2) :: Gen Int) 1 *Main> generate (choose (1, 2) :: Gen Int) 1 *Main> generate (choose (1, 2) :: Gen Int) 2 *Main> generate (choose (1, -2) :: Gen Int) 0 *Main> generate (choose (1, -2) :: Gen Int) -1 *Main> generate (choose (1, -2) :: Gen Int) -1 *Main> generate (choose (1, -2) :: Gen Int) -1 *Main> generate (choose (1, -2) :: Gen Int) -2 *Main> generate (choose (1, 1) :: Gen Int) 1 *Main> generate (choose (1, 1) :: Gen Int) 1 *Main> generate (choose (1, 1) :: Gen Int) 1 *Main> :t elements elements :: [a] -> Gen a *Main> generate $ elements ['a','e','i','o','u'] 'u' *Main> generate $ elements ['a','e','i','o','u'] 'u' *Main> generate $ elements ['a','e','i','o','u'] 'a' *Main> generate $ elements ['a','e','i','o','u'] 'e' *Main> :t vector vector :: Arbitrary a => Int -> Gen [a] *Main> generate $ (vector 100 :: Gen [Int]) [-4,26,20,-21,17,9,-8,-12,-8,8,-26,-22,6,8,-12,16,4,25,25,-7,6,2,30,-2,20,-17,-8,-18,-4,-27,-16,-10,-5,0,-8,-14,29,16,2,20,-23,6,3,-20,21,-27,-17,-4,-29,-22,20,11,-8,-16,-27,29,-2,-25,15,-26,-4,27,-23,-15,1,-25,-18,9,-11,-21,-10,13,26,-16,19,-23,-29,-25,25,7,-7,-12,21,-22,26,4,11,4,13,-20,-23,21,-29,-2,5,-17,-9,-16,3,-23] *Main> generate $ (vector 7 :: Gen [Int]) [-17,24,14,-22,10,-29,-25] *Main> :t frequency frequency :: [(Int, Gen a)] -> Gen a *Main> generate $ frequency [(1, elements ['e', 'f', 'g']), (1, elements ['a', 'b', 'c']), (1, vector 10 :: Gen [Char ])] :82:89: error: • Couldn't match type ‘[Char]’ with ‘Char’ Expected type: Gen Char Actual type: Gen [Char] • In the expression: vector 10 :: Gen [Char] In the expression: (1, vector 10 :: Gen [Char]) In the first argument of ‘frequency’, namely ‘[(1, elements ['e', 'f', ....]), (1, elements ['a', 'b', ....]), (1, vector 10 :: Gen [Char])]’ *Main> generate $ frequency [(1, elements ["e", "f", "g"]), (1, elements ["a", "b", "c"]), (1, vector 10 :: Gen [Char ])] "g" *Main> generate $ frequency [(1, elements ["e", "f", "g"]), (1, elements ["a", "b", "c"]), (1, vector 10 :: Gen [Char ])] "\11604Nt\GS[\66673\DC4\US\\\55147" *Main> generate $ frequency [(1, elements ["e", "f", "g"]), (1, elements ["a", "b", "c"]), (1, vector 10 :: Gen [Char ])] "(]\ESCp\1096670\1045825\EM\STXy|" *Main> generate $ frequency [(1, elements ["e", "f", "g"]), (1, elements ["a", "b", "c"]), (1, vector 10 :: Gen [Char ])] "g" *Main> generate $ frequency [(1, elements ["e", "f", "g"]), (1, elements ["a", "b", "c"]), (1, vector 10 :: Gen [Char ])] "g" *Main> generate $ frequency [(1, elements ["e", "f", "g"]), (1, elements ["a", "b", "c"]), (1, vector 10 :: Gen [Char ])] "f" *Main> generate $ frequency [(1, elements ["e", "f", "g"]), (1, elements ["a", "b", "c"]), (1, vector 10 :: Gen [Char ])] "a" *Main> generate (arbitrary :: Gen Color) Red *Main> generate (arbitrary :: Gen Color) Blue *Main> :t forAll forAll :: (Show a, Testable prop) => Gen a -> (a -> prop) -> Property *Main> quickCheck prop_replicate'' *** Failed! Exception: 'Prelude.!!: index too large' (after 1 test): 0 0 0