From 3cf46e36c2f174bac7b4a922b445063c384df55e Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Sun, 7 Jan 2024 22:30:05 +0100 Subject: [PATCH] minigen: ensure that it is possible to run with only MSeq implemented Reported-by: Neven Villani --- bin/minigen.ml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/minigen.ml b/bin/minigen.ml index 0fac657..adb26fe 100644 --- a/bin/minigen.ml +++ b/bin/minigen.ml @@ -37,16 +37,15 @@ let () = | None -> Random.self_init () | Some s -> Random.init s -module RandGen = Generator.Make(MRand) -module SeqGen = Generator.Make(MSeq) +let generate (module M : Utils.MonadPlus) = + let module Gen = Generator.Make(M) in + M.run @@ Gen.typed ~depth:config.depth let () = - begin - if config.exhaustive then - MSeq.run @@ SeqGen.typed ~depth:config.depth - else - MRand.run @@ RandGen.typed ~depth:config.depth - end + generate + (if config.exhaustive + then (module MSeq) + else (module MRand)) |> Seq.take config.count |> Seq.map STLCPrinter.print_term |> List.of_seq