Library
Module
Module type
Parameter
Class
Class type
update_subtree p f t
replaces the subtree t'
rooted at p
in t
with f t'
.
val update_singleton :
path ->
('a option -> ('a option, 'error) result) ->
'a t ->
('a t, 'error) result
update_singleton p f t
replaces the value v
at p
in t
with the result of f
. If there was no binding at p
, f None
is evaluated. Otherwise, f (Some v)
is used. If the result is None
, the old binding at p
(if any) is removed. Otherwise, if the result is Some v'
, the value at p
is replaced by v'
.
update_root f t
updates the value at root with f
. It is equivalent to update_singleton
[] f t
.
val union :
?rev_prefix:path ->
(rev_path:path -> 'a -> 'a -> ('a, 'error) result) ->
'a t ->
'a t ->
('a t, 'error) result
union ~rev_prefix merger t1 t2
merges two tries t1
and t2
. If both tries have a binding at the same path p
, it will call merger ~rev_path:p x y
to reconcile the values x
from t1
and y
from t2
that are both bound at the (reversed) path rev_path
. The path rev_path
is reversed for efficient traversal.