I've been trying to pick up Haskell recently, but I am having some difficulty with QuickCheck2 (which I'm trying to learn while coding up the 99 problems). I've looked at this question along with related ones on the matter.
Like OP from the aforementioned question, I'm interested in finding out whether it is possible for QuickCheck2 to expect exceptions. I know this is possible with QuickCheck 1. Some googling around led me to the following version of my code to test a myLast function which returns the last element of a list:
prop_myLast :: [Int] -> Bool
prop_myLast [] = expectFailure . myLast $ []
prop_myLast xs = myLast xs == last xs
Of course, this (1) does not typecheck, since expectFailure returns a Property and (2) requires an import from v1 of QuickCheck. Regarding (1) I don't really see how to make this work - I tried looking up how to catch exceptions on my own but was met with more difficulty because this started bringing in the IO monad. With respect to (2) I don't know if bringing in the expectFailure function is a good idea in the first place - could anyone experienced with the system tell me if I'm supposed to be using components from both v1 and v2? If not, where is the analogous expectFailure for v2 of QuickCheck?