From 300e4a04360d559618fa41fdf037a744e4e7c0eb Mon Sep 17 00:00:00 2001 From: Estevan Castilho Date: Sat, 22 Aug 2026 22:16:47 +0000 Subject: The directory protocol --- lib/protocols/Directory.ml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/protocols/Directory.ml (limited to 'lib/protocols/Directory.ml') diff --git a/lib/protocols/Directory.ml b/lib/protocols/Directory.ml new file mode 100644 index 0000000..5a2637f --- /dev/null +++ b/lib/protocols/Directory.ml @@ -0,0 +1,16 @@ +class type implementation = object + method list : string list + method find : string -> Handle.t option +end + +type Handle.protocol += Directory of implementation + +type t = implementation + +let make impl = Directory impl + +let from handle = Handle.into handle (function Directory impl -> Some impl | _ -> None) + +let list i = Handle.invoke i (fun o -> o#list) + +let find i name = Handle.invoke i (fun o -> o#find name) -- cgit v1.2.3