12345678910111213141516171819202122232425262728(** Runtime support functions for [@@deriving hegel_generator].
These helpers are used by the code generated by the [ppx_hegel_generator]
PPX deriver. They are not intended for direct use by end users.
The PPX generates [Internal.test_case -> 'a] functions that call
{!Hegel.Generators.draw} internally and return typed OCaml values. These
helpers provide the plumbing for option and list types. *)open!Core(** [generate_option tc gen_fn] generates an [option] value.
Uses {!Generators.booleans} to decide between [Some] and [None]. When [Some]
is chosen, calls [gen_fn tc] to produce the inner value. *)letgenerate_optiontcgen_fn=letb=Generators.drawtc(Generators.booleans())inifbthenSome(gen_fntc)elseNone;;(** [generate_list tc gen_fn] generates a list of values.
Uses {!Generators.integers} to determine the list length (0-20), then calls
[gen_fn tc] for each element. *)letgenerate_listtcgen_fn=letlen=Generators.drawtc(Generators.integers~min_value:0~max_value:20())inList.initlen~f:(fun_->gen_fntc);;