(patch) Add the satisfy function.
All checks were successful
/ Build and Test Library Snapshot (pull_request) Successful in 2m10s

This commit is contained in:
Pat Garrity 2025-09-11 21:46:47 -05:00
parent a74f30f912
commit abb0e26292
Signed by: pfm
GPG key ID: 5CA5D21BAB7F3A76

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(()))