package liquidsoap-lang

  1. Overview
  2. Docs
include module type of struct include Value end
and env = (string * Value.t) list
and lazy_env = (string * Value.t Stdlib.Lazy.t) list
and in_value = Value.in_value =
  1. | Ground of Term.Ground.t
  2. | List of Value.t list
  3. | Tuple of Value.t list
  4. | Null
  5. | Fun of (string * string * Value.t option) list * lazy_env * Term.t
  6. | FFI of (string * string * Value.t option) list * env -> Value.t
val string_of_float : float -> 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 Abstract = Value.Abstract
module type AbstractDef = Value.AbstractDef
module MkAbstractFromTerm = Value.MkAbstractFromTerm
module MkAbstract = Value.MkAbstract
module RuntimeType = Value.RuntimeType
module Ground = Term.Ground
module Methods = Term.Methods
type t = Type.t
type module_name = string
type scheme = Type.scheme
type value = Value.t = {
  1. pos : Pos.Option.t;
  2. value : in_value;
  3. methods : value Methods.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 : (bool * string * Type.t) 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 mk : ?pos:(Stdlib.Lexing.position * Stdlib.Lexing.position) -> in_value -> value
val unit : value
val int : int -> value
val bool : bool -> value
val float : float -> value
val string : string -> value
val tuple : {t}3 list -> value
val product : {t}3 -> {t}3 -> value
val list : {t}3 list -> value
val null : value
val meth : value -> (string * value) list -> value
val record : (string * value) list -> value
val val_fun : (string * string * {t}3 option) list -> (env -> {t}3) -> value
val term_fun : (string * string * {t}3 option) list -> Term.t -> value
val val_cst_fun : (string * {t}3 option) list -> value -> value
val reference : (unit -> {t}3) -> ({t}3 -> 'a) -> value

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 -> (string * value) list -> value
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) 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 -> value -> env -> value) Stdlib.ref
val apply : value -> env -> Value.t

High-level manipulation of values

val to_unit : value -> unit
val to_bool : value -> bool
val to_bool_getter : value -> unit -> bool
val to_fun : value -> env -> Value.t
val to_string : value -> string
val to_string_getter : value -> unit -> string
val to_float : value -> float
val to_float_getter : value -> unit -> float
val to_int : value -> int
val to_int_getter : value -> unit -> int
val to_num : value -> [> `Float of float | `Int of int ]
val to_list : value -> {t}3 list
val to_tuple : value -> {t}3 list
val to_option : value -> value option
val to_valued_option : (value -> 'a) -> value -> 'a option
val to_default_option : default:'a -> (value -> 'a) -> value -> 'a
val to_product : value -> {t}3 * {t}3
val to_string_list : value -> string list
val to_int_list : value -> int list
val to_getter : value -> unit -> Value.t
val to_ref : {t}3 -> (unit -> Value.t) * ({t}3 -> unit)
val to_valued_ref : (Value.t -> '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:Stdlib.Printexc.raw_backtrace -> ?message:string -> pos:Pos.t list -> string -> 'a
val runtime_error_of_exception : bt:Stdlib.Printexc.raw_backtrace -> kind:string -> exn -> Runtime_error.runtime_error
val raise_as_runtime : bt:Stdlib.Printexc.raw_backtrace -> kind:string -> exn -> 'a
val environment : unit -> (string * string) list
module Single_position : sig ... end
module Position : sig ... end
module Stacktrace : sig ... end
val pos_var : string
val pos : (string * value) list -> (Stdlib.Lexing.position * Stdlib.Lexing.position) list
OCaml

Innovation. Community. Security.