package ecaml

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

An 'a Type.t is an isomorphism between 'a and a subset of Value.t.

type 'a t = {
  1. name : Core_kernel.Sexp.t;
  2. of_value_exn : t -> 'a;
  3. to_value : 'a -> t;
}
val sexp_of_t : ('a -> Ppx_sexp_conv_lib.Sexp.t) -> 'a t -> Ppx_sexp_conv_lib.Sexp.t
val bool : bool t
val ignored : unit t
val int : int t
val string : string t
val unit : unit t
val value : t t
val list : 'a t -> 'a list t
val option : 'a t -> 'a option t
val alist : 'a t -> 'b t -> ('a * 'b) list t
val tuple : 'a t -> 'b t -> ('a * 'b) t

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

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

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

val sexpable : (module Core_kernel.Sexpable with type t = 'a) -> name:Core_kernel.Sexp.t -> 'a t

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

val caml_embed : 'a Core_kernel.Type_equal.Id.t -> 'a t

Embed values of type 'a. Note that unlike other functions above, the values are not transformed, so this can be used to preserve state in emacs. More precisely, this following returns true:

let var = Var.create (Value.Type.caml_embed type_id) in
Current_buffer.set_value var v;
phys_equal v (Current_buffer.value_exn var)
val path_list : string list 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.

val map : 'a t -> name:Core_kernel.Sexp.t -> of_:('a -> 'b) -> to_:('b -> 'a) -> 'b t