package ecaml

  1. Overview
  2. Docs
Module type
Class type

Wrap wraps an Elisp function as an OCaml function. Idiomatic use looks like:

let not = Funcall.Wrap.("not" <: bool @-> return bool)
let about_emacs = Funcall.Wrap.("about-emacs" <: nullary @-> return nil)
val return : 'a Value.Type.t -> 'a t
val nil : unit Value.Type.t
val nullary : unit Value.Type.t
val (<:) : string -> 'a t -> 'a
val (@->) : 'a Value.Type.t -> 'b t -> ('a -> 'b) t
include Value.Type.S
val create : Core.Sexp.t -> ('a -> Core.Sexp.t) -> (Value.t -> 'a) -> ('a -> Value.t) -> 'a Value.Type.t
val with_of_value_exn : 'a Value.Type.t -> (Value.t -> 'a) -> 'a Value.Type.t
val to_sexp : 'a Value.Type.t -> 'a -> Core.Sexp.t
val bool : bool Value.Type.t
val float : float Value.Type.t
val ignored : unit Value.Type.t
val int : int Value.Type.t
val string : string Value.Type.t
val string_cached : string Value.Type.t

string_cached is like string, except it uses of_utf8_bytes_cached.

val unit : unit Value.Type.t
val value : Value.t Value.Type.t
val list : 'a Value.Type.t -> 'a list Value.Type.t
val vector : 'a Value.Type.t -> 'a array Value.Type.t
val array_as_list : 'a Value.Type.t -> 'a array Value.Type.t

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

val option : 'a Value.Type.t -> 'a option Value.Type.t

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

val nil_or : 'a Value.Type.t -> 'a option Value.Type.t

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_.

val alist : 'a Value.Type.t -> 'b Value.Type.t -> ('a * 'b) list Value.Type.t
val tuple : 'a Value.Type.t -> 'b Value.Type.t -> ('a * 'b) Value.Type.t

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

val tuple2_as_list : 'a Value.Type.t -> 'b Value.Type.t -> ('a * 'b) Value.Type.t

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 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 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.


Innovation. Community. Security.