Ocf.Wrapper
val make :
( ?with_doc:bool -> 'a -> Yojson.Safe.t ) ->
( ?def:'a -> Yojson.Safe.t -> 'a ) ->
'a t
of_ok_error f json
applies f
to json
. If it returns `Ok x
, then x
is returned. Else invalid_value
is called with the given json
. This function is useful to wrap *_of_yojson
functions generated by ppx_deriving_yojson.
val int : int t
val float : float t
val bool : bool t
val string : string t
val string_ : ( 'a -> string ) -> ( string -> 'a ) -> 'a t
val string_map :
fold:( ( string -> 'a -> assocs -> assocs ) -> 'map -> assocs -> assocs ) ->
add:( string -> 'a -> 'map -> 'map ) ->
empty:'map ->
'a t ->
'map t
To create a map from strings to 'a
. This will be stored in JSON as
{ foo: ..., bar: ..., ... }
Here foo
and bar
are the keys in the resulting map. The Map.S.fold
, Map.S.add
and Map.S.empty
functions can be used for parameters fold
, add
and empty
.