package ppx_type_directed_value

  1. Overview
  2. Docs

Module Type_directed.VariantSource

Data structure that packages the associated Keys of a variant

E.g., the corresponding Variant of the following variant

  type t =
    | A
    | B of int * string
    | C of { f:int }

is

  [ { name = "A"; value = Unlabelled [] }
  ; { name = "B"; value = Unlabelled [ M_int; M_string ] }
  ; { name = "C"; value = Labelled [ { name = "f"; value = M_int } ] }
  ]

with type

  (unit,
   (int * (string * unit), (int * unit, Nothing.t) Either.t)
     Either.t)
    Either.t

Parameters

Signature

Sourcetype 'a variant =
  1. | Unlabelled : ('a, 'length) Variant_constructor(M).t -> 'a variant
  2. | Labelled : ('a, 'length) Record(M).t -> 'a variant
Sourcetype ('a, 'length) t =
  1. | [] : (Base.Nothing.t, Type_nat.zero) t
  2. | :: : ('a variant, 'a M.attribute) Key.t * ('b, 'l) t -> (('a, 'b) Base.Either.t, 'l Type_nat.succ) t
OCaml

Innovation. Community. Security.