(patch) Add the satisfy function. #9

Merged
pfm merged 1 commit from add-satisfy into main 2025-09-13 02:21:12 +00:00
Showing only changes of commit abb0e26292 - Show all commits

View file

@ -52,6 +52,16 @@ object Datagen:
*/
def gen(): A = generate(())
/** Satisfy the target generator (that requires input) using this generator
* to provide that input.
*
* @param target
* The target generator.
* @return
* The new input-satisfied generator.
*/
def satisfy[B](target: Datagen[B, A]): Gen[B] = target.toGen(gen())
def flatMap[B](f: A => NoInput[B]): NoInput[B] =
new NoInput.Defer[B](() => f(generate(())).generate(()))