Open
Description
Seq.pick
is a very useful function that applies a given "chooser" function to successive elements, returning the first x
where the function returns Some x
. By analogy, I think FsCheck should provide a similar function. Here's a simple implementation that demonstrates the idea:
let rec pick chooser gn =
gen {
let! value = gn
match chooser value with
| Some v -> return v
| None -> return! pick chooser gn
}