package jsont

  1. Overview
  2. Docs
Declarative JSON data manipulation for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

jsont-0.3.0.tbz
sha512=507ab6b3d8718f322fb74999b3b82dbc1d36037042cb9067e5b8b63df80524a0602cc26e487b6e4ce061d65767162d6ffa00e173d9f51ce66cdd2a63482a350e

doc/jsont/Jsont/Object/Case/index.html

Module Object.CaseSource

Case objects.

Case objects are used to describe objects whose members depend on the tag value of a distinguished case member. See an example.

Maps

Sourcetype 'a jsont := 'a t
Sourcetype ('cases, 'case, 'tag) map

The type for mapping a case object represented by 'case belonging to a common type represented by 'cases depending on the value of a case member of type 'tag.

Sourceval map : ?dec:('case -> 'cases) -> 'tag -> 'case jsont -> ('cases, 'case, 'tag) map

map ~dec v obj defines the object map obj as being the case for the tag value v of the case member. dec indicates how to inject the object case into the type common to all cases.

Raises Invalid_argument if obj is not a direct result of finish, that is if obj does not describe an object.

Sourceval map_tag : ('cases, 'case, 'tag) map -> 'tag

map_tag m is m's tag.

Cases

Sourcetype ('cases, 'tag) t

The type for a case of the type 'cases. This is map with its 'case representation hidden.

Sourceval make : ('cases, 'case, 'tag) map -> ('cases, 'tag) t

make map is map as a case.

Sourceval tag : ('cases, 'tag) t -> 'tag

tag c is the tag of c.

Case values

Sourcetype ('cases, 'tag) value

The type for case values. This holds a case value and its case map map. Use value to construct them.

Sourceval value : ('cases, 'case, 'tag) map -> 'case -> ('cases, 'tag) value

value map v is a case value v described by map.