[Haskell-cafe] QuickCheck

rodrigo.bonifacio rodrigo.bonifacio at uol.com.br
Sun Mar 16 13:42:30 EDT 2008


Hi all,

I'm trying to use the quick-check library for checking some properties of a user defined data type. Bellow the target data type:

data Feature = 
 Feature Id Name FeatureType GroupType Children Properties | 
 FeatureError

where: 

Id = String
Name = String 
FeatureType = int 
GroupType = int
Children = [Feature]
Propertyes = [String]


I've written the following quick-check property:

prop_AlternativeFeature :: Feature -> Feature -> QuickCheck.Property 
prop_AlternativeFeature fm fc = length (children fc) == 0 ==> length  (checkAlternativeFeature fm fc) > 0

When I try to check such property, the result is:

ERROR "./EshopModelChecking.hs":11 - Type error in instance member binding
*** Term           : arbitrary
*** Type           : Feature
*** Does not match : Gen Feature

I think that I need to write some arbitrary or generator functions, but I didn't realize how to do that with the availalble quick-checking documentation. 

Any help will be welcome.

Thanks in advance.

Rodrigo.



More information about the Haskell-Cafe mailing list