summaryrefslogtreecommitdiff
path: root/lib/model/reference.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2026-11-19 11:32:16 +0100
committerSébastien Dailly <sebastien@dailly.me>2026-11-19 11:32:16 +0100
commit8708171877054c98aad45079d85d4e699420f2fe (patch)
tree2e580e6891708b7b70d07f7bec03bd0a76ae171b /lib/model/reference.ml
parente1bf7686f408b52a870d4ed4f3c565dbbcc3954f (diff)
Added fields in lists
Diffstat (limited to 'lib/model/reference.ml')
-rw-r--r--lib/model/reference.ml24
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/model/reference.ml b/lib/model/reference.ml
index 67bbcaf..bdacf54 100644
--- a/lib/model/reference.ml
+++ b/lib/model/reference.ml
@@ -1,11 +1,17 @@
-(** A lazy pointer to a resolved content. The payload is
- [t Typ.target Content.t] — i.e. {!Model.content} — and is only forced once
- every content has been registered (see [Configuration.Ast.check]), which
- is what allows cyclic references between contents. *)
-type t = T : t Typ.target Content.t Lazy.t -> t [@@unboxed]
+(** A lazy pointer to a resolved content. The payload is [target Content.t] —
+ i.e. {!Model.content} — and is only forced once every content has been
+ registered (see [Configuration.Ast.check]), which is what allows cyclic
+ references between contents. *)
+type t = T : target Content.t Lazy.t -> t [@@unboxed]
-let v : (unit -> t Typ.target Content.t) -> t =
- fun f -> T (lazy (f ()))
+(** The target of a reference field, resolved: either a lazy pointer to a
+ content, or a static list. The list case carries the list itself, whose own
+ fields are typed with this very [target] — references inside a list can
+ only target other lists (enforced by the configuration reader). *)
+and target =
+ | Content of t
+ | List of target Data_list.t
-let get : t -> t Typ.target Content.t = fun (T target) ->
- Lazy.force target
+let v : (unit -> target Content.t) -> t = fun f -> T (lazy (f ()))
+
+let get : t -> target Content.t = fun (T target) -> Lazy.force target