A t represents a match statement where every case is documented. You can then use it
in one way to extract documentation, and in another way as the underlying function.
More specifically, an ('input,'output) t represents a match statement matching things
of type input' and producing things of type 'output. It consists of
specific_cases and a catchall_case.
The specific_cases are straightforward:
{pattern=pattern;documentation=documentation;value=value} represents
"| pattern -> value", with documentation explaining what's going on.
The catchall_case can be either `Unused x, representing "| _ -> x" with no
documentation, or `Used case, representing "| x -> f x", where f is case.value,
and case.documentation explains what's going on with f. This is intended to allow
many input values to be handled uniformly without having to document each one individually.
prepend ~specific_cases t matches on specific_cases before moving on to t.
A common situation is representing let f t x = match x with | `A -> ... | `B -> ... | _ -> TODO: CUSTOM
which can be done by combining prepend and map:
let f' =
prepend ~specific_cases:{pattern = `A;...};{pattern = `B;...}
(map g' ~f:(fun h t -> TODO: CUSTOM))
match_ t pulls out the underlying function of t