package bap-std

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Variants of values.

type 'a t = 'a tag

register ~name ~uuid (module T) creates a new variant constructor, that accepts values of type T.t. Module T should implement Binable.S and Sexpable.S interfaces, provide compare and pretty-printing pp functions. This functions will be used to print, compare and serialize values.

uuid and name parameters must be string literals, i.e., they must be known at compile time. This is to prevent the abuse of type system.

The returned value of type T.t tag is a special key that can be used with create and get functions to pack and unpack values of type T.t into value.

val register : name:literal -> uuid:literal -> (module S with type t = 'a) -> 'a tag

register ~name ~uuid (module T) creates a new variant constructor, that accepts values of type T.t. Module T should implement Binable.S and Sexpable.S interfaces, provide compare and pretty-printing pp functions. This functions will be used to print, compare and serialize values.

uuid and name parameters must be string literals, i.e., they must be known at compile time. This is to prevent the abuse of type system.

The returned value of type T.t tag is a special key that can be used with create and get functions to pack and unpack values of type T.t into value.

val name : 'a t -> string

name cons returns a name of a constructor.

val same : 'a t -> 'b t -> bool
val same_witness : 'a t -> 'b t -> ('a, 'b) Core_kernel.Std.Type_equal.t option
val same_witness_exn : 'a t -> 'b t -> ('a, 'b) Core_kernel.Std.Type_equal.t
val typeid : 'a t -> typeid
OCaml

Innovation. Community. Security.