package records

  1. Overview
  2. Docs

Module RecordSource

Dynamic records

Layouts

Sourcetype 's layout

The representation of record types. 's is usually a phantom type. Two interfaces are provided for creating layouts, in Unsafe and Safe.

Sourceexception ModifyingSealedStruct of string

Raised by field or seal if layout has already been sealed.

Records

Sourcetype 's t = {
  1. layout : 's layout;
  2. content : 's content;
}

The representation of record values.

Sourceand 's content
Sourceval get_layout : 'a t -> 'a layout

Get the layout of a record.

Sourceexception AllocatingUnsealedStruct of string

Raised by make when the corresponding layout has not been sealed.

Sourcemodule Type : sig ... end
Sourcemodule Field : sig ... end
Sourceval get : 's t -> ('a, 's) Field.t -> 'a

Get the value of a field.

Sourceval set : 's t -> ('a, 's) Field.t -> 'a -> unit

Set the value of a field.

Sourceexception UndefinedField of string

Raised by get if the field was not set.

Sourcemodule Polid : sig ... end
Sourcemodule Unsafe : sig ... end
Sourcemodule Safe : sig ... end

Miscellaneous

Sourceval to_yojson : 'a t -> Yojson.Safe.t

Convert a record to JSON.

Sourceval of_yojson : 'a layout -> Yojson.Safe.t -> ('a t, string) Result.t

Convert a JSON value into a given schema.

Sourcemodule Util : sig ... end
Sourceval equal : 'a layout -> 'b layout -> ('a, 'b) Polid.equal

Equality predicate.

OCaml

Innovation. Community. Security.