Sexp_helpers.Variant_specHelper to read variants from s-expressions. Supports nullary, unary, and variadic variants with proper error messages for each case.
The goal overtime is to extend the capability of this mini interpreter by improving behaviors such as error reporting, user-friendly hints, etc. This is left as future work.
type 'a conv = | Nullary of 'aVariant with no argument, e.g., `return
| Unary_with_context of context:Sexplib0.Sexp.t -> arg:Sexplib0.Sexp.t -> 'aVariant with one argument, e.g., `equals of string
| Unary of Sexplib0.Sexp.t -> 'aFor Unary when context is not needed (most of them).
*)| Variadic of context:Sexplib0.Sexp.t -> fields:Sexplib0.Sexp.t list -> 'aVariant with multiple arguments, e.g., `skip_paths of Glob.t list
type 'a t = 'a case list