diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-13 14:27:37 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-13 14:27:37 -0300 |
| commit | ca8c92915bd3a7fa19ef57b8bd5a9b3f16d05254 (patch) | |
| tree | 630de49e86dfc3a87b4e5187f022b7183cbe7e4a /lib/protocols | |
| parent | 9b9eab0bb54ed951c56eb6551d9ee470dc5b43aa (diff) | |
| download | RNT-ca8c92915bd3a7fa19ef57b8bd5a9b3f16d05254.tar.gz RNT-ca8c92915bd3a7fa19ef57b8bd5a9b3f16d05254.zip | |
fol evaluator
Diffstat (limited to '')
| -rw-r--r-- | lib/protocols/Program.ml | 31 | ||||
| -rw-r--r-- | lib/protocols/Program.mli | 36 |
2 files changed, 36 insertions, 31 deletions
diff --git a/lib/protocols/Program.ml b/lib/protocols/Program.ml index b82cafc..49e6e2d 100644 --- a/lib/protocols/Program.ml +++ b/lib/protocols/Program.ml @@ -1,17 +1,20 @@ -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 +module type PROGRAM = sig + type t end -type Handle.protocol += Program of implementation -type t = implementation +module Make (P : PROGRAM) = struct + class type implementation = object + method invoke : + program:P.t -> + Context.t -> + (Handle.t, Concepts.Condition.condition) result + end + + type Handle.protocol += Program of 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) + type t = implementation + + let make impl = Program (impl :> implementation) + let from handle = Handle.into handle (function Program impl -> Some impl | _ -> None) + let invoke i ~program ctx = Handle.invoke i (fun o -> o#invoke ~program ctx) +end diff --git a/lib/protocols/Program.mli b/lib/protocols/Program.mli index a795f16..1d6c3ae 100644 --- a/lib/protocols/Program.mli +++ b/lib/protocols/Program.mli @@ -1,21 +1,23 @@ -type t +module type PROGRAM = sig + type t +end + +module Make (P : PROGRAM) : sig + type t + + class type implementation = object + method invoke : + program:P.t -> + Context.t -> + (Handle.t, Concepts.Condition.condition) result + end -class type implementation = object - method entry_points : string BatFingerTree.t - method invoke : - entry:string -> - bindings:Concepts.Tuple.t -> + val make : #implementation -> Handle.protocol + val from : Handle.t -> t Handle.interface option + + val invoke : + t Handle.interface -> + program:P.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 |
