diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-09-11 04:06:52 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-11 01:06:52 -0300 |
| commit | b79224410f469a1cd4ff3be4f8e62d71398109fc (patch) | |
| tree | e025feebbdf9703ce790b4a97cb9997242c9bb4b /lib/kernel/Path.ml | |
| parent | efe8032f7e224c29fc67a4f8cfd52db908442eec (diff) | |
| download | RNT-b79224410f469a1cd4ff3be4f8e62d71398109fc.tar.gz RNT-b79224410f469a1cd4ff3be4f8e62d71398109fc.zip | |
Multigroup objects
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 |
