package liquidsoap-lang

  1. Overview
  2. Docs
include module type of struct include Value end
type env = (string * Value.t) list

We derive a hash of the environment to invalidate the cache when the builtin env change. We mostly keep name and methods.

and dynamic_methods = Value.dynamic_methods = {
  1. hidden_methods : string list;
  2. methods : string -> Value.t option;
}
type fun_v = Value.fun_v = {
  1. fun_args : (string * string * Value.t option) list;
  2. fun_env : env;
  3. fun_body : Term.t;
}
type ffi = Value.ffi = {
  1. ffi_args : (string * string * Value.t option) list;
  2. ffi_fn : env -> Value.t;
}
type in_value = [
  1. | `Int of int
  2. | `Float of float
  3. | `String of string
  4. | `Bool of bool
  5. | `Null
  6. | `Custom of Liquidsoap_lang.Term.Custom.t
  7. | `List of Value.t list
  8. | `Tuple of Value.t list
  9. | `Fun of fun_v
  10. | `FFI of ffi
]
val set_pos : Value.t -> Pos.Option.t -> Value.t
val has_flag : Value.t -> Flags.flag -> bool
val add_flag : Value.t -> Flags.flag -> unit
val is_unit : Value.t -> bool
val make : ?pos:Pos.Option.base -> ?methods:Value.t Runtime_term.Methods.t -> ?flags:Flags.flags -> in_value -> Value.t
val string_of_int_value : flags:Flags.flags -> int -> string
val invoke : Value.t -> string -> Value.t

Find a method in a value.

val invokes : Value.t -> string list -> Value.t

Perform a sequence of invokes: invokes x l1;l2;l3;... is x.l1.l2.l3...

val demeth : Value.t -> Value.t
val remeth : Value.t -> Value.t -> Value.t
val split_meths : Value.t -> (string * Value.t) list * Value.t
val compare : Value.t -> Value.t -> int
module type Custom = Value.Custom
module type CustomDef = Value.CustomDef
module MkCustomFromTerm = Value.MkCustomFromTerm
module MkCustom = Value.MkCustom
module RuntimeType = Value.RuntimeType
module Methods = Term.Methods
type t = Type.t
type module_name = string
type scheme = Type.scheme
type value = Value.t

Type construction

val int_t : Type.t
val unit_t : Type.t
val float_t : Type.t
val bool_t : Type.t
val string_t : Type.t
val tuple_t : Type.t list -> Type.t
val product_t : Type.t -> Type.t -> Type.t
val record_t : (string * Type.t) list -> Type.t
val optional_record_t : (string * Type.t) list -> Type.t
val method_t : Type.t -> (string * Type.scheme * string) list -> Type.t
val optional_method_t : Type.t -> (string * Type.scheme * string) list -> Type.t
val of_tuple_t : Type.t -> Type.t list
val of_product_t : Type.t -> Type.t * Type.t
val fun_t : Type.t Type_base.argument list -> Type.t -> Type.t
val list_t : Type.t -> Type.t
val of_list_t : Type.t -> Type.t
val nullable_t : Type.t -> Type.t
val univ_t : ?constraints:Type.constr list -> unit -> Type.t
val getter_t : Type.t -> Type.t
val ref_t : Type.t -> Type.t

Value construction

val unit : Value.t
val int : int -> Value.t
val octal_int : int -> Value.t
val hex_int : int -> Value.t
val bool : bool -> Value.t
val float : float -> Value.t
val string : string -> Value.t
val tuple : Value.t list -> Value.t
val product : Value.t -> Value.t -> Value.t
val list : Value.t list -> Value.t
val null : Value.t
val meth : Value.t -> (string * Value.t) list -> Value.t
val record : (string * Value.t) list -> Value.t
val val_fun : (string * string * {t}3 option) list -> (env -> {t}3) -> Value.t
val term_fun : (string * string * {t}3 option) list -> Term.t -> Value.t
val val_cst_fun : (string * {t}3 option) list -> {t}3 -> Value.t
val reference : (unit -> {t}3) -> ({t}3 -> 'a) -> Value.t

Helpers for defining builtin functions.

type proto = (string * t * value option * string option) list
val builtin_type : (string * Type.t * 'a option * 'b) list -> Type.t -> Type.t
val meth_fun : Value.t -> (string * Value.t) list -> Value.t
val mk_module_name : ?base:string -> string -> string
val add_builtin : category:Doc.Value.category -> descr:string -> ?flags:Doc.Value.flag list -> ?meth:(string * Type.scheme * string * Value.t) list -> ?examples:string list -> ?base:string -> string -> (string * Type_base.t * Value.t option * string option) list -> Type.t -> (env -> {t}3) -> string
val add_builtin_value : category:Doc.Value.category -> descr:string -> ?flags:Doc.Value.flag list -> ?base:string -> string -> Value.t -> Type.t -> string
val add_builtin_base : category:Doc.Value.category -> descr:string -> ?flags:Doc.Value.flag list -> ?base:string -> string -> in_value -> Type.t -> string
val add_module : ?base:string -> string -> string
val module_name : 'a -> 'a
val apply_fun : (?pos:Pos.t list -> value -> env -> value) ref
val apply : ?pos:Pos.t list -> value -> env -> value

High-level manipulation of values

val to_unit : {t}3 -> unit
val to_bool : {t}3 -> bool
val to_bool_getter : {t}3 -> unit -> bool
val to_fun : value -> env -> value
val to_string : {t}3 -> string
val to_string_getter : {t}3 -> unit -> string
val to_float : {t}3 -> float
val to_float_getter : {t}3 -> unit -> float
val to_int : {t}3 -> int
val to_int_getter : {t}3 -> unit -> int
val to_num : {t}3 -> [> `Float of float | `Int of int ]
val to_list : {t}3 -> {t}3 list
val to_tuple : {t}3 -> {t}3 list
val to_option : {t}3 -> {t}3 option
val to_valued_option : ({t}3 -> 'a) -> {t}3 -> 'a option
val to_default_option : default:'a -> ({t}3 -> 'a) -> {t}3 -> 'a
val to_product : {t}3 -> {t}3 * {t}3
val to_string_list : {t}3 -> string list
val to_int_list : {t}3 -> int list
val to_getter : {t}3 -> unit -> value
val to_ref : {t}3 -> (unit -> value) * ({t}3 -> unit)
val to_valued_ref : (value -> 'a) -> ('b -> {t}3) -> {t}3 -> (unit -> 'a) * ('b -> unit)
val assoc : 'a -> int -> ('a * 'b) list -> 'b

assoc lbl n l returns the nth element in l * of which the first component is lbl.

val raise_error : ?bt:Printexc.raw_backtrace -> ?message:string -> pos:Pos.t list -> string -> 'a
val runtime_error_of_exception : bt:Printexc.raw_backtrace -> kind:string -> exn -> Runtime_error.runtime_error
val raise_as_runtime : bt:Printexc.raw_backtrace -> kind:string -> exn -> 'a
val environment : unit -> (string * string) list
module Position : sig ... end
module Stacktrace : sig ... end
val pos_var : string
val pos : (string * {t}3) list -> Pos.t list
OCaml

Innovation. Community. Security.