Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file process_intf.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160moduletypeShared=sigtypejson(** [member key json] searches the JSON object [json], which
must be an [`Assoc] element, for [key] and returns the
value or [`Null] if the [key] is missing *)valmember:string->[>`Assocof(string*json)list]->json(** [index idx json] returns the [idx]-th JSON object in the [json] array,
which must be an [`List] element. A negative [idx] value starts from
the end with -1 being the last element. A [Failure] exception is raise
if the idx is out of bounds *)valindex:int->[>`Listofjsonlist]->json(** [map f json] applies the function [f] to each element of the JSON
array [json], which must be an [`List] element, and returns a
[`List] element *)valmap:(json->json)->[>`Listofjsonlist]->[>`Listofjsonlist](** [to_assoc json] converts the JSON object [`Assoc a] to [a] *)valto_assoc:[>`Assocof(string*json)list]->(string*json)list(** [to_bool json] converts [`Bool b] to [b] *)valto_bool:[>`Boolofbool]->bool(** [to_bool_option json] converts [`Bool b] to [Some b] and [`Null] to [None] *)valto_bool_option:[>`Boolofbool|`Null]->booloption(** [to_float json] converts [`Float f] to [f] *)valto_float:[>`Floatoffloat]->float(** [to_float_option json] converts [`Float f] to [Some f] and [`Null] to [None] *)valto_float_option:[>`Floatoffloat|`Null]->floatoption(** [to_option f json] returns [None] if [json] is [`Null] otherwise [Some (f json)]. *)valto_option:(([>`Null]as'a)->json)->'a->jsonoption(** [to_list json] converts [`List l] to [l] *)valto_list:[>`Listofjsonlist]->jsonlist(** [to_number json] converts [`Float f] to [f] *)valto_number:[>`Floatoffloat]->float(** [to_number_option json] converts [`Float f] to [Some f] and [`Null] to [None] *)valto_number_option:[>`Floatoffloat|`Null]->floatoption(** [to_string json] converts [`String s] to [s] *)valto_string:[>`Stringofstring]->string(** [to_string_option json] converts [`String s] to [Some s] and [`Null] to [None] *)valto_string_option:[>`Stringofstring|`Null]->stringoption(** [convert_each f json] applies the function [f] to each element of the
JSON array [json], which must be an [`List] element, and returns a
list of the returned values. *)valconvert_each:(json->json)->[>`Listofjsonlist]->jsonlist(** [filter_map f l] applies [f] to each element of the list [l] and returns
a new list with the values [v] for which [f] returned [Some v]. *)valfilter_map:('a->'aoption)->'alist->'alist(** [rev_filter_map f acc l] applies [f] to each element of the list [l] and
prepends the values for which [f] returned [Some v] to list [acc]. [acc]
is returned as the result and is in reverse order to the input. This is
a tail call optimised version of [filter_map] *)valrev_filter_map:('a->'aoption)->'alist->'alist->'alist(** [flatten l] given a list of [json] elements filters the [`List] elements
and flattens them into a single list. This is the same as
[filter_list |> List.flatten] *)valflatten:[>`Listof'alist]list->'alist(** [rev_flatten acc l] is the tail recursive version of [flatten] with
the result accumulated in [acc]. The result is in reverse order. *)valrev_flatten:'alist->[>`Listof'alist]list->'alist(** [filter_index i l] returns the [i]'th element from each [`List l1] in [l].
Thus,
{[
[[`List [`Int 2; `Int 3]; `List [`Int 4; `Int 5]] |> filter_index 1]
]}
returns [[`Int 3; `Int 5]]
*)valfilter_index:int->[>`Listofjsonlist]list->jsonlist(** [filter_list l] returns a list of all the values of [`List value] elements in l *)valfilter_list:[>`Listof'a]list->'alist(** [filter_assoc l] returns a list of all the values of [`Assoc value] elements in l *)valfilter_assoc:[>`Assocof'a]list->'alist(** [filter_bool l] returns a list of all the values of [`Bool value] elements in l *)valfilter_bool:[>`Boolofbool]list->boollist(** [filter_float l] returns a list of all the values of [`Float value] elements in l *)valfilter_float:[>`Floatoffloat]list->floatlist(** [filter_string l] returns a list of all the values of [`String value] elements in l *)valfilter_string:[>`Stringofstring]list->stringlist(** [filter_member key js] given a [key] and a list of json [`Assoc]-s, [js], returns
the list of values extracted from each of the [`Assoc]-s. Thus,
{[
[[`Assoc [("id", `Int 1)]; `Assoc [("id", `Int 2)]]] |> filter_member "id"]
]}
returns [[`Int 1; `Int 2]] *)valfilter_member:string->[>`Assocof(string*json)list]list->jsonlist(**[filter_number l] returns a list of all the values of [`Float value] elements in l *)valfilter_number:[>`Floatoffloat]list->floatlist(** [keys assoc] returns all the keys from the [`Assoc] element *)valkeys:[>`Assocof(string*'a)list]->stringlist(** [values assoc] returns all the values from the [`Assoc] element *)valvalues:[>`Assocof(string*'a)list]->'alist(** [combine assoc1 assoc2] appends the associative lists of two [`Assoc] elements returning
an [`Assoc] element *)valcombine:[>`Assocof'alist]->[>`Assocof'alist]->[>`Assocof'alist](** [sort json] sorts the [json] tree based on field names. Objects and lists are sorted
recursively. Note that the function only sorts field names and not the values.
The sort is stable *)valsort:([>`Assocof(string*'a)list|`Listof'alist]as'a)->'aendmoduletypeBasic=sigtypejson(** [to_number json] converts [`Float f] to [f] and [Int i] to [float i] *)valto_number:[>`Intofint|`Floatoffloat]->float(** [to_number_option json] converts [`Float f] to [Some f], [`Int i] to [Some (float i)]
and [`Null] to [None] *)valto_number_option:[>`Intofint|`Floatoffloat|`Null]->floatoption(** [to_int json] converts [`Int i] to [i] *)valto_int:[>`Intofint]->int(** [to_int_option json] converts [`Int i] to [Some i] and [`Null] to [None] *)valto_int_option:[>`Intofint|`Null]->intoption(** [filter_int l] returns a list of all the values of [`Int value] elements in l *)valfilter_int:[>`Intofint]list->intlistvalfilter_number:[>`Intofint|`Floatoffloat]list->floatlistendmoduletypeExtended=sigtypejson(** [sort json] sorts the [json] tree based on field names. Objects and lists are sorted
recursively. Note that the function only sorts field names and not the values.
The sort is stable *)valsort:([>`Assocof(string*'a)list|`Listof'alist|`Tupleof'alist|`Variantof'b*'aoption]as'a)->'aend