KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Say I want to write some unit tests for the (!!) function. my_prop xs n = ... I want to restrict n to only valid indexes and I know I could do something like my_prop xs n = (not.null) (drop n xs) ==> ... But this makes it so that the vast majority of the generated cases are invalid and get thrown away. Is there a way I can set things up so that QuickCheck generates the xs list first and uses its value to generate only valid cases of n ?
Tags (comma-separated)
Save Edits
Cancel