aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/Path.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kernel/Path.ml')
-rw-r--r--lib/kernel/Path.ml17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/kernel/Path.ml b/lib/kernel/Path.ml
new file mode 100644
index 0000000..803d8cf
--- /dev/null
+++ b/lib/kernel/Path.ml
@@ -0,0 +1,17 @@
+type t = string list
+
+let this = []
+let (@/) x y = x::y
+
+let rec lookup handle = function
+ | [] -> Ok (Some handle)
+ | x::xs ->
+ let open Utilities.Result in
+ let open Protocols in
+ match Protocols.Directory.from handle with
+ | None -> Ok None
+ | Some dir ->
+ let* elem = Directory.find dir x in
+ match elem with
+ | None -> Ok None
+ | Some elem -> lookup elem xs