aboutsummaryrefslogtreecommitdiffstats
path: root/lib/protocols/Associative.ml
blob: 66de5ed4f796802bef8879bf7a94391c17469d16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class type implementation = object
  method update : string -> Handle.t option -> (Handle.t, Concepts.Condition.condition) result
end

type Handle.protocol += Associative of implementation

type t = implementation

let make impl = Associative (impl :> implementation)

let from handle = Handle.into handle (function Associative impl -> Some impl | _ -> None)

let update i key value = Handle.invoke i (fun o ->
                             let open Utilities.Result in
                             let* h = o#update key value in
                             Handle.require from h)