package ecaml

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Obsoletes : sig ... end
type 'a t
val sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
module Open_on_rhs_intf : sig ... end
include Core.Applicative.Let_syntax with type 'a t := 'a t with module Open_on_rhs_intf := Open_on_rhs_intf
module Let_syntax : sig ... end
include Open_on_rhs_intf.S with type 'a t := 'a t
val return : 'a -> 'a t
val map : 'a t -> f:('a -> 'b) -> 'b t
val both : 'a t -> 'b t -> ('a * 'b) t
val required : string -> 'a Ecaml_value.Value.Type.t -> 'a t
val optional : string -> 'a Ecaml_value.Value.Type.t -> 'a option t
val rest : string -> 'a Ecaml_value.Value.Type.t -> 'a list t
val optional_with_default : string -> 'a -> 'a Ecaml_value.Value.Type.t -> 'a t
val optional_with_nil : string -> 'a Ecaml_value.Value.Type.t -> 'a t

An optional argument whose Value.Type.t handles nil directly.

include Ecaml_value.Value.Type.S
val create : Core.Sexp.t -> ('a -> Core.Sexp.t) -> (Ecaml_value.Value.t -> 'a) -> ('a -> Ecaml_value.Value.t) -> 'a Ecaml_value.Value.Type.t
val with_of_value_exn : 'a Ecaml_value.Value.Type.t -> (Ecaml_value.Value.t -> 'a) -> 'a Ecaml_value.Value.Type.t
val to_sexp : 'a Ecaml_value.Value.Type.t -> 'a -> Core.Sexp.t
val bool : bool Ecaml_value.Value.Type.t
val float : float Ecaml_value.Value.Type.t
val ignored : unit Ecaml_value.Value.Type.t
val string : string Ecaml_value.Value.Type.t
val string_cached : string Ecaml_value.Value.Type.t

string_cached is like string, except it uses of_utf8_bytes_cached.

val unit : unit Ecaml_value.Value.Type.t
val array_as_list : 'a Ecaml_value.Value.Type.t -> 'a array Ecaml_value.Value.Type.t

Represent an ocaml array as an elisp list, without creating an intermediate ocaml list.

option represents None as nil and Some a as cons v nil, where v is the representation of a.

nil_or t_ represents None as nil and Some a as v, where v is the representation of a. This is a common representation used by Elisp functions. But it is only correct if nil is not a representation of any value in t; in that situation use Type.option_.

Represent a tuple (a,b) as the elisp cons cell (a . b)

Represent a tuple (a,b) as the elisp list '(a b)

val sexpable : (module Core.Sexpable with type t = 'a) -> name:Core.Sexp.t -> 'a Ecaml_value.Value.Type.t

Embed a sexpable ocaml type, so we can save values of the type in emacs, e.g. as buffer local variables

val path_list : string list Ecaml_value.Value.Type.t

A list of directories. Each element is a string (directory name) or nil (try default directory). nil values are converted to ".", which has the same meaning.

module Interactive : sig ... end
module For_testing : sig ... end
module Returns : sig ... end

An Returns.t states the return type of a function and whether the function returns a value of that type directly or via a Deferred.t. An (a, a) Returns.t means that the function returns a directly. An (a, a Deferred.t) Returns.t means that the function returns a via an a Deferred.t.

type 'a defun := Symbol.t -> Core.Source_code_position.t -> docstring:string -> ?define_keys:(Keymap.t * string) list -> ?obsoletes:Obsoletes.t -> ?should_profile:bool -> ?interactive:Interactive.t -> ?disabled:Symbol.Disabled.t -> ?evil_config:Evil.Config.t -> 'a
val defun : ((_, 'a) Returns.t -> 'a t -> unit) defun
val defun_nullary : ((_, 'a) Returns.t -> (unit -> 'a) -> unit) defun
val defun_nullary_nil : ((unit -> unit) -> unit) defun
val defalias : Symbol.t -> Core.Source_code_position.t -> ?docstring:string -> alias_of:Symbol.t -> unit -> unit

(describe-function 'defalias) (Info-goto-node "(elisp)Defining Functions")

val define_obsolete_alias : Symbol.t -> Core.Source_code_position.t -> ?docstring:string -> alias_of:Symbol.t -> since:string -> unit -> unit

(describe-function 'define-obsolete-function-alias)

N.B. Load order matters. A subsequent defun will override the aliasing.

val lambda : Core.Source_code_position.t -> ?docstring:string -> ?interactive:Interactive.t -> (_, 'a) Returns.t -> 'a t -> Ecaml_value.Function.t
val lambda_nullary : Core.Source_code_position.t -> ?docstring:string -> ?interactive:Interactive.t -> (_, 'a) Returns.t -> (unit -> 'a) -> Ecaml_value.Function.t
val lambda_nullary_nil : Core.Source_code_position.t -> ?docstring:string -> ?interactive:Interactive.t -> (unit -> unit) -> Ecaml_value.Function.t
val apply : 'a t -> Ecaml_value.Value.t array -> function_:Core.Sexp.t -> defined_at:Lexing.position -> 'a

apply t args ~function_ ~defined_at applies args to t, using function_ and defined_at to construct a nice error message if args are not what t expects.

It helps define functions which must inspect some of their arguments to determine the number and type of the remaining arguments.