(patch) Add the satisfy function. (#9)
All checks were successful
/ Build and Release Library (push) Successful in 2m13s

Reviewed-on: #9
This commit is contained in:
Pat Garrity 2025-09-13 02:21:11 +00:00
parent a74f30f912
commit 56bc62c333

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