package base

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

Efficient static string dictionaries. By static, we mean that new key-value pairs cannot be added after the dictionary is created.

This uses the algorithm the OCaml compiler uses for pattern matching on strings.

type 'a t
include sig ... end
val hash_fold_t : (Hash.state -> 'a -> Hash.state) -> Hash.state -> 'a t -> Hash.state
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val sexp_of_t : ('a -> Sexp.t) -> 'a t -> Sexp.t

We don't use @@deriving_inline sexp@@@end to avoid a circular dependency

val t_of_sexp : (Sexp.t -> 'a) -> Sexp.t -> 'a t
val of_alist : (string * 'a) list -> ('a t, string) Pervasives.result

Creates a dictionary from an association list. It is an error for the list to contain duplicate keys.

val of_alist_exn : (string * 'a) list -> 'a t
val find : 'a t -> string -> 'a option
val find_exn : 'a t -> string -> 'a
val to_alist : 'a t -> (string * 'a) list