aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/Path.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-09-13 02:31:39 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-09-13 02:31:39 -0300
commit327d0d2a47591e02299d4e7360d5b7e03b4962d2 (patch)
tree52d5ff1a51e7996da15816bc17a4dbaa15eac602 /lib/kernel/Path.ml
parent28ddfe4cd64a228bedf4c9068f443643e8496f7e (diff)
downloadRNT-327d0d2a47591e02299d4e7360d5b7e03b4962d2.tar.gz
RNT-327d0d2a47591e02299d4e7360d5b7e03b4962d2.zip
delete remaining trash
Diffstat (limited to '')
-rw-r--r--lib/kernel/Path.ml28
-rw-r--r--lib/kernel/Path.mli2
2 files changed, 13 insertions, 17 deletions
diff --git a/lib/kernel/Path.ml b/lib/kernel/Path.ml
index cd51efb..803d8cf 100644
--- a/lib/kernel/Path.ml
+++ b/lib/kernel/Path.ml
@@ -1,21 +1,17 @@
-type t = string BatFingerTree.t
+type t = string list
-let this = BatFingerTree.empty
+let this = []
+let (@/) x y = x::y
-let of_string s =
- String.split_on_char '/' s |> List.filter (fun s -> s <> "") |> BatFingerTree.of_list
-
-let (@/) segment path = BatFingerTree.cons path segment
-
-let rec lookup handle path =
- let open Utilities.Result in
- match BatFingerTree.front path with
- | None -> Ok (Some handle)
- | Some (rest, segment) -> (
+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* found = Protocols.Directory.find dir segment in
- match found with
+ | Some dir ->
+ let* elem = Directory.find dir x in
+ match elem with
| None -> Ok None
- | Some handle' -> lookup handle' rest))
+ | Some elem -> lookup elem xs
diff --git a/lib/kernel/Path.mli b/lib/kernel/Path.mli
index 9ef4103..85d0ca9 100644
--- a/lib/kernel/Path.mli
+++ b/lib/kernel/Path.mli
@@ -1,6 +1,6 @@
type t
val this : t
-val of_string : string -> t
val (@/) : string -> t -> t
+
val lookup : Protocols.Handle.t -> t -> (Protocols.Handle.t option, Concepts.Condition.condition) result