val conflict :
('a, unit, string, ('b, conflict)Stdlib.resultLwt.t)Stdlib.format4->'a
Return Error (Conflict str).
val bind :
('a, 'b)Stdlib.resultLwt.t->('a->('c, 'b)Stdlib.resultLwt.t)->('c, 'b)Stdlib.resultLwt.t
bind r f is the merge result which behaves as of the application of the function f to the return value of r. If r fails, bind r f also fails, with the same conflict.
val map :
('a->'c)->('a, 'b)Stdlib.resultLwt.t->('c, 'b)Stdlib.resultLwt.t
map f m maps the result of a merge. This is the same as bind m (fun x -> ok (f x)).
Merge Combinators
type'a promise = unit ->('a option, conflict)Stdlib.resultLwt.t
An 'a promise is a function which, when called, will eventually return a value type of 'a. A promise is an optional, lazy and non-blocking value.
idempotent t is the default merge function for values of type t using idempotent operations. It follows the same rules as the default merge function but also adds:
Lift a merge function to optional values of the same type. If all the provided values are inhabited, then call the provided merge function, otherwise use the same behavior as default.
The type for counter values. It is expected that the only valid operations on counters are increment and decrement. The following merge functions ensure that the counter semantics are preserved: i.e. it ensures that the number of increments and decrements is preserved.
We consider the only valid operations for maps and association lists to be:
Adding a new bindings to the map.
Removing a binding from the map.
Replacing an existing binding with a different value.
Trying to add an already existing binding is a no-op.
We thus assume that no operation on maps is modifying the key names. So the following merge functions ensures that (i) new bindings are preserved (ii) removed bindings stay removed and (iii) modified bindings are merged using the merge function of values.
Note: We only consider sets of bindings, instead of multisets. Application developers should take care of concurrent addition and removal of similar bindings themselves, by using the appropriate multi-sets.