OCaml let rec x = Json_encoder.y
printer.
Primitive and reference types are never on the LHS of an equation. Instead, they are expanded when used on the RHS of an equation.
A nested compound type is fully printed on the RHS of an equation.
val singletons_of_array :
len:int ->
[ `List of
[ `Any
| `Array of [ `List of 'a | `Singleton of 'a ] list
| `Boolean
| `Choice of 'a list
| `Integer
| `Null
| `Number
| `ObjectN of (string * 'a) list
| `String ] as 'a
| `Singleton of 'a ]
list ->
'a list
val splat :
Restapis_o.Open__.Ezjsonm.value ->
(string * Restapis_o.Open__.Ezjsonm.value option) list
val json_to_string :
[ `Any
| `Array of [ `List of 'a | `Singleton of 'a ] list
| `Boolean
| `Choice of 'a list
| `Integer
| `Null
| `Number
| `ObjectN of (string * 'a) list
| `String ] as 'a ->
Restapis_o.Open__.Ezjsonm.value ->
string
val string_to_json :
p:string ->
sep:char ->
inner_sep:char ->
value_sep:char option ->
leading:bool ->
[ `Any
| `Array of [ `List of 'a | `Singleton of 'a ] list
| `Boolean
| `Choice of 'a list
| `Integer
| `Null
| `Number
| `ObjectN of (string * 'a) list
| `String ] as 'a ->
string ->
Restapis_o.Open__.Ezjsonm.value option * int
val json_to_form :
string ->
[ `Any
| `Array of [ `List of 'a | `Singleton of 'a ] list
| `Boolean
| `Choice of 'a list
| `Integer
| `Null
| `Number
| `ObjectN of (string * 'a) list
| `String ] as 'a ->
Restapis_o.Open__.Ezjsonm.value ->
string list
val string_to_best_json_choice :
p:string ->
sep:char ->
inner_sep:char ->
value_sep:char option ->
leading:bool ->
kindchoices:
[ `Any
| `Array of [ `List of 'a | `Singleton of 'a ] list
| `Boolean
| `Choice of 'a list
| `Integer
| `Null
| `Number
| `ObjectN of (string * 'a) list
| `String ] as 'a
list ->
string ->
Restapis_o.Open__.Ezjsonm.value option * int
val nvs_to_json :
kind:
[ `Any
| `Array of [ `List of 'a | `Singleton of 'a ] list
| `Boolean
| `Choice of 'a list
| `Integer
| `Null
| `Number
| `ObjectN of (string * 'a) list
| `String ] as 'a ->
p:[ `None | `Deep of string | `Shallow of string ] ->
sep:char ->
inner_sep:char ->
value_sep:char option ->
leading:bool ->
(string * string) list ->
Restapis_o.Open__.Ezjsonm.value option
nvs_to_json ~kind ~p ~sep ~inner_sep ~leading nvs
takes the name value pairs nvs
and attempts to convert them to a JSON object of kind kind
.
When p = None
, all the name value pairs are considered. That mode is good for decoding forms.
When p = Some propname
, only the name value pairs that use the property name propname
are considered. For example, when propname = Some "color"
then nvs = [("color", "red"); ("color[]", "blue"), ("color[rgb]", "FFFFFF")]
will all be considered.
val query_cookie_header_nvs :
Restapis_o.Open__.Uri.t ->
(string * string) list ->
(string * string) list * (string * string) list * (string * string) list
include DkCoder_Std.SCRIPT
__init context
is the entry point for running a script module. The DkCoder compiler will inject this function at the top and bottom of the script module. The top __init
does nothing, while the bottom __init
calls the prior __init
.
That means:
- calling the
__init
function guarantees that the script module is initialized; that is, all of the script module's side-effects (ex.let () = Format.printf "Hello world@."
) are executed before the__init
returns to the caller. - you can override the
__init
function by simply defining the__init
idempotently. That will shadow the top__init
and when the bottom__init
is executed your__init
will be called instead of the do-nothing top__init
.
Future versions of DkCoder will call __init
in dependency order for all `You
script modules. Your __init
function may be called several times.
__repl context
is the entry point for debugging a script module in a REPL. The DkCoder compiler will inject this function at the top and bottom of the script module. The top __repl
does nothing, while the bottom __repl
calls the prior __repl
.
That means:
- you can override the
__repl
function by simply defining the__repl
idempotently. That will shadow the top__repl
and when the bottom__repl
is executed your__repl
will be called instead of the do-nothing top__repl
.
The run-time module information for the script module.