diff options
Diffstat (limited to '')
| -rw-r--r-- | lib/protocols/Derived.ml | 10 | ||||
| -rw-r--r-- | lib/protocols/Derived.mli | 13 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/protocols/Derived.ml b/lib/protocols/Derived.ml new file mode 100644 index 0000000..1968ffc --- /dev/null +++ b/lib/protocols/Derived.ml @@ -0,0 +1,10 @@ +class type implementation = object + method within : Handle.t -> (Handle.t, Concepts.Condition.condition) result +end + +type Handle.protocol += Derived of implementation +type t = implementation + +let make impl = Derived (impl :> implementation) +let from handle = Handle.into handle (function Derived impl -> Some impl | _ -> None) +let within i directory = Handle.invoke i (fun o -> o#within directory) diff --git a/lib/protocols/Derived.mli b/lib/protocols/Derived.mli new file mode 100644 index 0000000..b3dce96 --- /dev/null +++ b/lib/protocols/Derived.mli @@ -0,0 +1,13 @@ +(** a relation computed from other relations. [within] gives the same + relation read against another directory of relations, so a snapshot + of the tree can hand out its derived relations as they were, or as + they would be, at that moment. *) +type t + +class type implementation = object + method within : Handle.t -> (Handle.t, Concepts.Condition.condition) result +end + +val make : #implementation -> Handle.protocol +val from : Handle.t -> t Handle.interface option +val within : t Handle.interface -> Handle.t -> (Handle.t, Concepts.Condition.condition) result |
