aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-09-20 21:39:41 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-09-24 21:27:41 -0300
commit55bac460c1a366c9e85c69287936af69a864c3b5 (patch)
tree7fb9374356739649983575c119eea06d2e49f85b /lib/kernel
parentb06d16a2eb0846799b3b039dee989cf1cb258b6a (diff)
downloadRNT-55bac460c1a366c9e85c69287936af69a864c3b5.tar.gz
RNT-55bac460c1a366c9e85c69287936af69a864c3b5.zip
constraint system from decker
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/Path.ml7
-rw-r--r--lib/kernel/Path.mli13
2 files changed, 18 insertions, 2 deletions
diff --git a/lib/kernel/Path.ml b/lib/kernel/Path.ml
index 629a527..5e77c30 100644
--- a/lib/kernel/Path.ml
+++ b/lib/kernel/Path.ml
@@ -1,6 +1,9 @@
type t = string list
let this = []
+let to_list path = path
+let of_list names = names
+let equal = List.equal String.equal
let (@/) x y = x::y
let to_string path =
@@ -30,11 +33,11 @@ let lookup handle path =
let open Utilities.Result in
let open Protocols in
match Directory.from handle with
- | None -> Error (Error.path_not_found path)
+ | None -> Error (Error.not_a_directory path)
| Some dir ->
let* elem = Directory.find dir x in
match elem with
- | None -> Error (Error.not_a_directory path)
+ | None -> Error (Error.path_not_found path)
| Some elem -> walk elem xs
in
walk handle path
diff --git a/lib/kernel/Path.mli b/lib/kernel/Path.mli
index 6a74350..f9f4cd0 100644
--- a/lib/kernel/Path.mli
+++ b/lib/kernel/Path.mli
@@ -3,6 +3,19 @@ type t
val this : t
val (@/) : string -> t -> t
+(** the names a path is made of, in the order it walks them *)
+val to_list : t -> string list
+
+(** a path from the names it walks, the inverse of [to_list] *)
+val of_list : string list -> t
+
+(** do two paths walk the same names *)
+val equal : t -> t -> bool
+
+(** a path as a single name, with the separator escaped where a
+ component contains it *)
+val to_string : t -> string
+
val lookup : Protocols.Handle.t -> t -> (Protocols.Handle.t, Concepts.Condition.condition) result
val update : Protocols.Handle.t -> t -> string -> Protocols.Handle.t option -> Protocols.Handle.t option -> (bool, Concepts.Condition.condition) result