package dune-private-libs

  1. Overview
  2. Docs
Private libraries of Dune

Install

Dune Dependency

Authors

Maintainers

Sources

dune-2.5.1.tbz
sha256=8f77d3a87f208e0d7cccaa1c48c4bb1bb87d62d07c3f25e9b8ba298e028ce52b
sha512=f209f12ced10c1abf8782bdb0143f4cec77795f7174d2cc75130afb1e01550b01f2f77b9e3ec4888efdad83d2f9878d179b39126f824f4e522f3ef4da34bf27e

doc/dune-private-libs.stdune/Stdune/Table/index.html

Module Stdune.Table

Hashtable with a simple polymorphic type, but without the polymorphic equality.

This module re-wraps the hashtable implementation provided by Hashtbl.Make under a different interface: we just have a single type ('k, 'v) t, similar to a polymorphic hashtable.

This means that if you want a hash table generic over the type of keys, you don't have to put your type inside a functor.

Unlike the polymorphich hashtable (('k, 'v) Hashtbl.t), this does not use polymorphic hash and polymorphic equality, so this module does respect abstraction boundaries.

type ('k, 'v) t
module type Key = sig ... end
val create : (module Key with type t = 'k) -> int -> ('k, 'v) t
val find : ('k, 'v) t -> 'k -> 'v option
val find_exn : ('k, 'v) t -> 'k -> 'v
val set : ('k, 'v) t -> 'k -> 'v -> unit
val add_exn : ('k, 'v) t -> 'k -> 'v -> unit
val add : ('k, 'v) t -> 'k -> 'v -> (unit, 'v) Result.t
val clear : ('k, 'v) t -> unit
val mem : ('k, _) t -> 'k -> bool
val keys : ('k, _) t -> 'k list
val foldi : ('k, 'v) t -> init:'init -> f:('k -> 'v -> 'init -> 'init) -> 'init
val fold : (_, 'v) t -> init:'init -> f:('v -> 'init -> 'init) -> 'init
val to_dyn : ('v -> Dyn.t) -> (_, 'v) t -> Dyn.t
val find_or_add : ('k, 'v) t -> 'k -> f:('k -> 'v) -> 'v
val remove : ('k, _) t -> 'k -> unit
val iter : (_, 'v) t -> f:('v -> unit) -> unit
val filteri_inplace : ('a, 'b) t -> f:(key:'a -> data:'b -> bool) -> unit
OCaml

Innovation. Community. Security.