Module Glue.InjectImperativeMaps

If there is an injection of t into u, and if the inverse mapping can be effectively computed, then an implementation of imperative maps for the type u can be transported to the type t.


module M : sig ... end
module I : sig ... end
module J : sig ... end


type key = I.t

The type of keys.

type 'data t

The type of association maps.

val create : unit -> 'data t

create() creates a fresh empty map.

val add : key -> 'data -> 'data t -> unit

add inserts a new entry or replaces an existing entry. The map is updated in place.

val find : key -> 'data t -> 'data

find raises Not_found if the key is not in the domain of the map.

val clear : 'data t -> unit

clear empties a map.

val iter : (key -> 'data -> unit) -> 'data t -> unit

iter iterates over all entries.