package liquidsoap-lang

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Liquidsoap_lang.LangSource

Values and types of the liquidsoap language.

Sourcetype t = Type.t

The type of a value.

Sourcetype module_name
Sourcetype scheme = Type.scheme
Sourcetype regexp

Values

Sourcemodule Ground : sig ... end

A typed value.

Sourcemodule Methods = Term.Methods
Sourcetype value = Value.t = {
  1. pos : Pos.Option.t;
  2. value : in_value;
  3. methods : value Methods.t;
}
Sourceand env = (string * value) list
Sourceand lazy_env = (string * value Lazy.t) list
Sourceand in_value = Value.in_value =
  1. | Ground of Ground.t
  2. | List of value list
  3. | Tuple of value list
  4. | Null
  5. | Fun of (string * string * value option) list * lazy_env * Term.t
  6. | FFI of (string * string * value option) list * env -> value
Sourceval demeth : value -> value
Sourceval split_meths : value -> (string * value) list * value

Computation

Sourceval apply_fun : (?pos:Pos.t -> value -> env -> value) ref
Sourceval apply : value -> env -> value

Multiapply a value to arguments. The argument t is the type of the result of the application.

Helpers for source builtins

Sourcetype proto = (string * t * value option * string option) list
Sourceval add_builtin : category:Doc.Value.category -> descr:string -> ?flags:Doc.Value.flag list -> ?meth:(string * Type.scheme * string * value) list -> ?examples:string list -> ?base:module_name -> string -> proto -> t -> (env -> value) -> module_name

Add a builtin to the language, high-level version for functions.

Sourceval add_builtin_value : category:Doc.Value.category -> descr:string -> ?flags:Doc.Value.flag list -> ?base:module_name -> string -> value -> t -> module_name

Add a builtin value to the language

Sourceval add_builtin_base : category:Doc.Value.category -> descr:string -> ?flags:Doc.Value.flag list -> ?base:module_name -> string -> in_value -> t -> module_name

Add a builtin to the language, more rudimentary version.

Sourceval add_module : ?base:module_name -> string -> module_name

Declare a new module.

Sourceval module_name : module_name -> string

Manipulation of values

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

assoc x n l returns the n-th y such that (x,y) is in the list l. * This is useful for retrieving arguments of a function.

Sourceval int_t : t
Sourceval unit_t : t
Sourceval float_t : t
Sourceval bool_t : t
Sourceval string_t : t
Sourceval regexp_t : t
Sourceval product_t : t -> t -> t
Sourceval of_product_t : t -> t * t
Sourceval tuple_t : t list -> t
Sourceval of_tuple_t : t -> t list
Sourceval record_t : (string * t) list -> t
Sourceval optional_record_t : (string * t) list -> t
Sourceval method_t : t -> (string * scheme * string) list -> t
Sourceval optional_method_t : t -> (string * scheme * string) list -> t
Sourceval list_t : t -> t
Sourceval of_list_t : t -> t
Sourceval nullable_t : t -> t
Sourceval ref_t : t -> t
Sourceval error_t : t
Sourceval fun_t : (bool * string * t) list -> t -> t

fun_t args r is the type of a function taking args as parameters * and returning values of type r. * The elements of r are of the form (b,l,t) where b indicates if * the argument is optional, l is the label of the argument ("" means no * label) and t is the type of the argument.

Sourceval univ_t : ?constraints:Type.constr list -> unit -> t
Sourceval getter_t : t -> t

A getter on an arbitrary type.

Sourceval unit : value
Sourceval int : int -> value
Sourceval bool : bool -> value
Sourceval float : float -> value
Sourceval string : string -> value
Sourceval regexp : regexp -> value
Sourceval list : value list -> value
Sourceval null : value
Sourceval product : value -> value -> value
Sourceval tuple : value list -> value
Sourceval meth : value -> (string * value) list -> value
Sourceval record : (string * value) list -> value
Sourceval reference : (unit -> value) -> (value -> unit) -> value
Sourceval val_fun : (string * string * value option) list -> (env -> value) -> value

Build a function from an OCaml function. Items in the prototype indicate the label and optional values. Second string value is used when renaming argument name, e.g. `fun (foo=_, ...) -> `

Sourceval term_fun : (string * string * value option) list -> Term.t -> value

Build a function from a term.

Sourceval val_cst_fun : (string * value option) list -> value -> value

Build a constant function. * It is slightly less opaque and allows the printing of the closure * when the constant is ground.

Sourceval pos : env -> Pos.t list

Extract position from the environment. Used inside function execution.

Sourceval raise_error : ?bt:Printexc.raw_backtrace -> ?message:string -> pos:Pos.List.t -> string -> 'a

Raise an error.

Sourceval runtime_error_of_exception : bt:Printexc.raw_backtrace -> kind:string -> exn -> Runtime_error.runtime_error

Convert an exception into a runtime error.

Sourceval raise_as_runtime : bt:Printexc.raw_backtrace -> kind:string -> exn -> 'a

Re-raise an error as a runtime error.

Sourceval environment : unit -> (string * string) list

Return the process' environment.

Sourceval descr_of_regexp : regexp -> string

Return an unescaped string description of a regexp, i.e. ^foo/bla$

Sourceval string_of_regexp : regexp -> string

Return a string description of a regexp value i.e. r/^foo\/bla$/g

Sourcemodule Regexp : sig ... end
OCaml

Innovation. Community. Security.