jon.recoil.org

Module Patterns.Head

type desc =
  1. | Any
  2. | Construct of Ocaml_typing.Types.constructor_description
  3. | Constant of Ocaml_typing.Typedtree.constant
  4. | Tuple of string option list
  5. | Unboxed_tuple of (string option * Ocaml_typing.Jkind.sort) list
  6. | Record of Ocaml_typing.Types.label_description list
  7. | Record_unboxed_product of Ocaml_typing.Types.unboxed_label_description list
  8. | Variant of {
    1. tag : Ocaml_parsing.Asttypes.label;
    2. has_arg : bool;
    3. cstr_row : Ocaml_typing.Types.row_desc Stdlib.ref;
    4. type_row : unit -> Ocaml_typing.Types.row_desc;
    }
  9. | Array of Ocaml_typing.Types.mutability * Ocaml_typing.Jkind.sort * int
  10. | Lazy
val arity : Ocaml_typing.Patterns.Head.t -> int

deconstruct p returns the head of p and the list of sub patterns.

  • raises [Invalid_arg

    _] if p is an or- or an exception-pattern.

reconstructs a pattern, putting wildcards as sub-patterns.