Module Catala_runtime.Value

type _ external_tag = ..
module type External = sig ... end
type _ ty =
  1. | Unit : unit ty
  2. | Bool : bool ty
  3. | Integer : integer ty
  4. | Money : money ty
  5. | Decimal : decimal ty
  6. | Date : date ty
  7. | Duration : duration ty
  8. | Position : code_location ty
  9. | Array : ('a -> t) -> 'a array ty
  10. | Tuple : ('a -> t list) -> 'a ty
  11. | Struct : {
    1. name : string;
    2. fields : 'a -> (string * t) list;
    } -> 'a ty
  12. | Enum : {
    1. name : string;
    2. constr : 'a -> int * string * t option;
    } -> 'a ty
  13. | External : (module External with type t = 'a) -> 'a ty
  14. | Function : 'a ty

'a ty provides runtime information about the structure of values of OCaml type 'a

and t =
  1. | V : 'a ty * 'a -> t

Runtime.Value.t is an embedded runtime value that comes with type information, allowing for introspection

val embed : 'a ty -> 'a -> t
val equal : code_location -> t -> t -> bool
val compare : code_location -> t -> t -> int
val format : Stdlib.Format.formatter -> t -> unit
val from_json : 'a ty -> code_location -> string -> 'a