ocaml-core / base / core / lib / univ.mli

(** An extensible "universal" variant type, that can be extended by adding new
    constructors with arguments of arbitrary type. *)
open Sexplib

(** The Constr.t represents a single constructor in the extensible variant type.  On
    creation, one must provide a name for the constructor (used only for display), and a
    sexp-converter for serializing the argument to the variant. *)
module Constr : sig
  type 'a t

  (** [create name to_sexp] *)
  val create : string -> ('a -> Sexp.t) -> 'a t
end

type t

val constr_name : t -> string

val sexp_of_t  : t -> Sexp.t

(** [create var arg] creates a new [t] from a constr and the argument to the constr. *)
val create : 'a Constr.t -> 'a -> t

(** [match_ t constr] does a single constr match on a [t] for a given constructor.  If the
    match succeeds, then the argument of the constructor is returned (as an option). *)
val match_ : t -> 'a Constr.t -> 'a option
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.