package ecaml

  1. Overview
  2. Docs
Module type
Class type

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

type 'a t
val sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
module type S = sig ... end
include S
val create : Core.Sexp.t -> ('a -> Core.Sexp.t) -> (t -> 'a) -> ('a -> t) -> 'a t
val with_of_value_exn : 'a t -> (t -> 'a) -> 'a t
val bool : bool t
val float : float t
val ignored : unit t
val int : int t
val string : string t
val string_cached : string t

string_cached is like string, except it uses of_utf8_bytes_cached.

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

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

val option : 'a t -> 'a option t

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

val nil_or : 'a t -> 'a option 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 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.Sexpable with type t = 'a) -> name:Core.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 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 id : 'a t -> 'a Core.Type_equal.Id.t
val to_value : 'a t -> 'a -> t
val of_value_exn : 'a t -> t -> 'a
val name : _ t -> Core.Sexp.t
val map : 'a t -> name:Core.Sexp.t -> of_:('a -> 'b) -> to_:('b -> 'a) -> 'b t
val to_sexp : 'a t -> 'a -> Core.Sexp.t
val map_id : 'a t -> Core.Sexp.t -> 'a t

map_id type_ name is short for map type_ ~name It is not interchangeable with type_ itself.

val enum : Core.Sexp.t -> (module Enum.S with type t = 'a) -> ('a -> t) -> 'a t
val enum_symbol : Core.Sexp.t -> (module Enum.S with type t = 'a) -> 'a t

enum_symbol name (module M) represents m : M.t as symbols named after Enum.to_string_hum (module M) m.

val stringable : Core.Sexp.t -> (module Core.Stringable.S with type t = 'a) -> 'a t

Innovation. Community. Security.