July 2017
Intermediate to advanced
284 pages
6h 45m
English
QuickCheck was originally written in 2000 by Koen Claessen and John Hughes. Their paper on the subject[28] is a detailed introduction. We won’t go into a lot of detail in this chapter, but reading this paper is highly encouraged. To get better acquainted, let’s write a simple property. We’ll use an example directly from the Haskell wiki.[29]
| | quickCheck ((\s -> s == s) :: [Char] -> Bool) |
We can try it by firing up GHCi.
| | $ stack exec ghci |
| | GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help |
| | Prelude> import Test.QuickCheck |
| | Prelude Test.QuickCheck> quickCheck ((\s -> s == s) :: [Char] -> Bool) |
| | +++ OK, passed 100 tests. |
First, we import the QuickCheck module. You may have noticed that we did that ...
Read now
Unlock full access