module Ka: sig
.. end
Patterns for Matching Labelled Collections of JSON Trees. These combine
patterns indexed by labels into patterns which match the remainder of an
association.
val any : Kojson.jain -> (string * Kojson.json) list
any
matches any remaining bindings and returns them.
val drop : string list -> Kojson.jain -> Kojson.jain
drop ls
removes the labels ls
.
val empty : 'a -> Kojson.jain -> 'a
empty x
matches the empty association and returns x
.
val stop : 'a -> Kojson.jain -> 'a
stop x
matches any association and returns x
, but warns about
present labels.
val fold : (string -> Kojson.jin -> 'a -> 'a) -> Kojson.jain -> 'a -> 'a
fold f
matches any association such that f lᵢ
matches the value vᵢ
bound to lᵢ
for each label. The composition f lₙ vₙ ∘ ⋯ ∘ f l₁ v₁
is returned.
val iter : (string -> Kojson.jin -> unit) -> Kojson.jain -> unit
iter f
matches any association such that f lᵢ
matches the value
vᵢ
bound to lᵢ
for each label.
val map : (string -> Kojson.jin -> 'a) -> Kojson.jain -> 'a list
map f
matches any association such that f lᵢ
matches the value vᵢ
bound to lᵢ
for each label. The list [f l₁ v₁; …; f lₙ vₙ]
is
returned.
val first : (Kojson.jain -> 'a) list -> Kojson.jain -> 'a
first_assoc [f₁; …; fₙ]
matches an association which is matched by fᵢ
for some i
, and returns the result of the first match.