From ca8c92915bd3a7fa19ef57b8bd5a9b3f16d05254 Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Sun, 13 Sep 2026 14:27:37 -0300 Subject: fol evaluator --- lib/protocols/Program.ml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'lib/protocols/Program.ml') 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 -- cgit v1.2.3