diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-09 22:10:21 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-11 01:07:40 -0300 |
| commit | 6ed1f50733d86d0da2adbde9e650f53f828f638e (patch) | |
| tree | 82916a8cb4d1157528c82a4294e6bd6995813b41 /lib/protocols/Program.ml | |
| parent | 962cf10614b0b3af8e0dd9d05b2f5720b1197f8d (diff) | |
| download | RNT-6ed1f50733d86d0da2adbde9e650f53f828f638e.tar.gz RNT-6ed1f50733d86d0da2adbde9e650f53f828f638e.zip | |
evaluator and program protocols
Diffstat (limited to '')
| -rw-r--r-- | lib/protocols/Program.ml | 17 | ||||
| -rw-r--r-- | lib/protocols/Program.mli | 21 |
2 files changed, 38 insertions, 0 deletions
diff --git a/lib/protocols/Program.ml b/lib/protocols/Program.ml new file mode 100644 index 0000000..b82cafc --- /dev/null +++ b/lib/protocols/Program.ml @@ -0,0 +1,17 @@ +class type implementation = object + method entry_points : string BatFingerTree.t + + method invoke : + entry:string -> + bindings:Concepts.Tuple.t -> + Context.t -> + (Handle.t, Concepts.Condition.condition) result +end + +type Handle.protocol += Program of implementation +type t = implementation + +let make impl = Program (impl :> implementation) +let from handle = Handle.into handle (function Program impl -> Some impl | _ -> None) +let entry_points i = Handle.invoke i (fun o -> o#entry_points) +let invoke i ~entry ~bindings ctx = Handle.invoke i (fun o -> o#invoke ~entry ~bindings ctx) diff --git a/lib/protocols/Program.mli b/lib/protocols/Program.mli new file mode 100644 index 0000000..a795f16 --- /dev/null +++ b/lib/protocols/Program.mli @@ -0,0 +1,21 @@ +type t + +class type implementation = object + method entry_points : string BatFingerTree.t + method invoke : + entry:string -> + bindings:Concepts.Tuple.t -> + Context.t -> + (Handle.t, Concepts.Condition.condition) result +end + +val make : #implementation -> Handle.protocol +val from : Handle.t -> t Handle.interface option +val entry_points : t Handle.interface -> string BatFingerTree.t + +val invoke : + t Handle.interface -> + entry:string -> + bindings:Concepts.Tuple.t -> + Context.t -> + (Handle.t, Concepts.Condition.condition) result |
