aboutsummaryrefslogblamecommitdiffstats
path: root/lib/protocols/Associative.ml
blob: aa691d0216a022b09ce40089868516108edd061d (plain) (tree)
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 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 reference value = Handle.invoke i (fun o ->
                                       let open Utilities.Result in
                                       let* h = o#update key reference value in
                                       Handle.require from h)