blob: 49e6e2da6e5b0625bf412236b789d47854e8f74b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
module type PROGRAM = sig
type t
end
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
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
|