summaryrefslogtreecommitdiff
path: root/lib/model/reference.ml
blob: 67bbcafd572234107cf13744d55f3b84104fd1dc (plain)
1
2
3
4
5
6
7
8
9
10
11
(** 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]

let v : (unit -> t Typ.target Content.t) -> t =
 fun f -> T (lazy (f ()))

let get : t -> t Typ.target Content.t = fun (T target) ->
  Lazy.force target