diff options
Diffstat (limited to '')
| -rw-r--r-- | lib/kernel/Path.ml | 17 | ||||
| -rw-r--r-- | lib/kernel/Path.mli | 6 |
2 files changed, 23 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 diff --git a/lib/kernel/Path.mli b/lib/kernel/Path.mli new file mode 100644 index 0000000..85d0ca9 --- /dev/null +++ b/lib/kernel/Path.mli @@ -0,0 +1,6 @@ +type t + +val this : t +val (@/) : string -> t -> t + +val lookup : Protocols.Handle.t -> t -> (Protocols.Handle.t option, Concepts.Condition.condition) result |
