package base

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

The type of keys. This will be 'key for polymorphic dictionaries, or some fixed type for dictionaries with monomorphic keys.

type ('key, 'data, 'phantom) t

Dictionaries. Their keys have type 'key key. Each key's associated value has type 'data. The dictionary may be distinguished by a 'phantom type.

type ('fn, 'key, 'data, 'phantom) creator

The type of creator functions 'fn that operate on ('key, 'data, 'phantom) t. May take extra arguments before 'fn, such as a comparison function.

val empty : (('key, 'data, 'phantom) t, 'key, 'data, 'phantom) creator

The empty dictionary.

val singleton : ('key key -> 'data -> ('key, 'data, 'phantom) t, 'key, 'data, 'phantom) creator

Dictionary with a single key/value pair.

val of_alist : (('key key * 'data) list -> [ `Ok of ('key, 'data, 'phantom) t | `Duplicate_key of 'key key ], 'key, 'data, 'phantom) creator

Dictionary containing the given key/value pairs. Fails if there are duplicate keys.

val of_alist_or_error : (('key key * 'data) list -> ('key, 'data, 'phantom) t Or_error.t, 'key, 'data, 'phantom) creator

Like of_alist. Returns a Result.t.

val of_alist_exn : (('key key * 'data) list -> ('key, 'data, 'phantom) t, 'key, 'data, 'phantom) creator

Like of_alist. Raises on duplicates.

val of_alist_multi : (('key key * 'data) list -> ('key, 'data list, 'phantom) t, 'key, 'data, 'phantom) creator

Produces a dictionary mapping each key to a list of associated values.

val of_alist_fold : (('key key * 'data) list -> init:'acc -> f:('acc -> 'data -> 'acc) -> ('key, 'acc, 'phantom) t, 'key, 'data, 'phantom) creator

Produces a dictionary using each key/value pair. Combines all values for a given key with init using f.

val of_alist_reduce : (('key key * 'data) list -> f:('data -> 'data -> 'data) -> ('key, 'data, 'phantom) t, 'key, 'data, 'phantom) creator

Produces a dictionary using each key/value pair. Combines multiple values for a given key using f.

val of_sequence : (('key key * 'data) Sequence.t -> [ `Ok of ('key, 'data, 'phantom) t | `Duplicate_key of 'key key ], 'key, 'data, 'phantom) creator

Like of_alist. Consumes a sequence.

val of_sequence_or_error : (('key key * 'data) Sequence.t -> ('key, 'data, 'phantom) t Or_error.t, 'key, 'data, 'phantom) creator

Like of_alist_or_error. Consumes a sequence.

val of_sequence_exn : (('key key * 'data) Sequence.t -> ('key, 'data, 'phantom) t, 'key, 'data, 'phantom) creator

Like of_alist_exn. Consumes a sequence.

val of_sequence_multi : (('key key * 'data) Sequence.t -> ('key, 'data list, 'phantom) t, 'key, 'data, 'phantom) creator

Like of_alist_multi. Consumes a sequence.

val of_sequence_fold : (('key key * 'data) Sequence.t -> init:'c -> f:('c -> 'data -> 'c) -> ('key, 'c, 'phantom) t, 'key, 'data, 'phantom) creator

Like of_alist_fold. Consumes a sequence.

val of_sequence_reduce : (('key key * 'data) Sequence.t -> f:('data -> 'data -> 'data) -> ('key, 'data, 'phantom) t, 'key, 'data, 'phantom) creator

Like of_alist_reduce. Consumes a sequence.

val of_list_with_key : ('data list -> get_key:('data -> 'key key) -> [ `Ok of ('key, 'data, 'phantom) t | `Duplicate_key of 'key key ], 'key, 'data, 'phantom) creator

Like of_alist. Consume values for which keys can be computed.

val of_list_with_key_or_error : ('data list -> get_key:('data -> 'key key) -> ('key, 'data, 'phantom) t Or_error.t, 'key, 'data, 'phantom) creator

Like of_alist_or_error. Consume values for which keys can be computed.

val of_list_with_key_exn : ('data list -> get_key:('data -> 'key key) -> ('key, 'data, 'phantom) t, 'key, 'data, 'phantom) creator

Like of_alist_exn. Consume values for which keys can be computed.

val of_list_with_key_multi : ('data list -> get_key:('data -> 'key key) -> ('key, 'data list, 'phantom) t, 'key, 'data, 'phantom) creator

Like of_alist_multi. Consume values for which keys can be computed.

val of_iteri : (iteri:(f:(key:'key key -> data:'data -> unit) -> unit) -> [ `Ok of ('key, 'data, 'phantom) t | `Duplicate_key of 'key key ], 'key, 'data, 'phantom) creator

Produces a dictionary of all key/value pairs that iteri passes to ~f. Fails if a duplicate key is found.

val of_iteri_exn : (iteri:(f:(key:'key key -> data:'data -> unit) -> unit) -> ('key, 'data, 'phantom) t, 'key, 'data, 'phantom) creator

Like of_iteri. Raises on duplicate key.

OCaml

Innovation. Community. Security.