package records

  1. Overview
  2. Docs
type 'a t = {
  1. name : string;
  2. to_json : 'a -> Yojson.Basic.json;
  3. of_json : Yojson.Basic.json -> 'a;
}

How to convert a type to and from JSON.

  • deprecated Please use Record.Type.t instead
val make : name:string -> to_json:('a -> Yojson.Basic.json) -> of_json:(Yojson.Basic.json -> 'a) -> unit -> 'a t

Declare a new type.

  • deprecated Please use Record.Type.make instead
val make_string : name:string -> to_string:('a -> string) -> of_string:(string -> 'a) -> unit -> 'a t

Declare a new type that marshal/unmarshal to strings.

  • deprecated Please use Record.Type.make_string instead
val exn : exn t

How to represent exceptions.

  • deprecated Please use Record.Type.exn instead
exception UnserializedException of string

Raised by exn.of_json

val unit : unit t

How to represent unit.

  • deprecated Please use Record.Type.unit instead
val string : string t

How to represent string.

  • deprecated Please use Record.Type.string instead
val int : int t

How to represent int.

  • deprecated Please use Record.Type.int instead
val list : 'a t -> 'a list t

Build a representation of a list.

  • deprecated Please use Record.Type.list instead
val product_2 : string -> 'a t -> string -> 'b t -> ('a * 'b) t

Build a representation of a couple. The labels identify the elements, not their types.

  • deprecated Please use Record.Type.product_2 instead
val view : name:string -> read:('a -> 'b) -> write:('b -> 'a) -> 'a t -> 'b t

Build a 'b type which has the same JSON encoding as the 'a type from conversion functions read and write.

  • deprecated Please use Record.Type.view instead
OCaml

Innovation. Community. Security.