Re: Sudoku assignment

52 views
Skip to first unread message

David Sands

unread,
Dec 2, 2014, 12:35:25 PM12/2/14
to FP

Hi!
In the last part of the assignment it says that the prop_SoundSolve should return a Property. Is it a typo and should be a Bool, or is it QuickChecks Property type? If it is the last alternative, where can I find information about it? Thanks in
advance!

Don’t think to much about the type. You have seen all you need to know to do that.

quickCheck can check functions that return a Bool or functions that return a Property.  Property is like a Bool, but with benefits. It is part of the quickCheck library and is the type you get when you use any of the quickCheck “extra” functions, like ==>, collect, classify. 

For example

prop_f :: String -> Bool
prop_f x = x /= "Hello"

prop_g :: String -> Property
prop_g x = length x < 10 ==> x /= “Hello"

This is the reason why we don’t normally write type signatures for quickCheck properties but use “where types = x::String” when we need to choose a type for checking.

Regards
Dave




Reply all
Reply to author
Forward
0 new messages