Identifiable.Map(3)

πŸ’– NAME πŸ’–

Identifiable.Map β€” bestie, there is literally no description. That's it. That's the whole name section. Iconic of it, honestly. πŸŽ€

This page lives in the OCaml library section, and the module type in question is β€” you guessed it β€” Identifiable.Map. And yes, the manual name is Identifiable.Map(3) in case you were wondering which page you wandered into, queen. πŸ’…


✨ Module type ✨

πŸ’œ Module type Map

module type Map
 = sig end

That's the whole thing up there β€” a sig ... end with the goods inside, which we're about to unwrap like a lil gift. 🎁


🌸 Documentation 🌸

Okay so inside Map you've got all of this, and ngl it's a lot, but we're getting through it together, fr fr:

  • module T : Map.OrderedType β€” the key module, giving us the ordering. Slay.
  • include Map.S β€” everything from Map.S is included. So all the standard map behaviour comes along for the ride. Standard map energy. πŸ‘‘

Then the extra functions this module adds on top:

  • val of_list : (key * 'a) list -> 'a t β€” build a map out of a list of key/'a pairs. Turn that list into a map, periodt.
  • val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Format.formatter -> 'a -> unit) -> 'a t -> 'a t -> 'a t β€” takes m1 and m2 and gives you a map containing all bindings from m1 and m2. But listen: if some binding is present in both and the associated value is not equal, a Fatal_error is raised. 😭 Not a vibe check you want to fail.
  • val union_right : 'a t -> 'a t -> 'a t β€” union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken. Right side wins, main character energy. πŸ’…
  • val union_left : 'a t -> 'a t -> 'a t β€” literally union_left m1 m2 = union_right m2 m1. That's the whole definition, bestie. Left side wins.
  • val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t β€” merge two maps with a function deciding the combined value. 🧚
  • val rename : key t -> key -> key β€” renames a key. πŸ¦‹
  • val map_keys : (key -> key) -> 'a t -> 'a t β€” map a function over all the keys. 🌈
  • val keys : 'a t -> Stdlib.Set.Make(T).t β€” hands you back the keys as a Stdlib.Set.Make(T).t. Yes, that set type exactly. No cap.
  • val data : 'a t -> 'a list β€” the values, as a list. πŸ“
  • val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t β€” build a map from a Stdlib.Set.Make(T).t, using a key -> 'a function to make the values. πŸŽ€
  • val transpose_keys_and_data : key t -> key t β€” transposes keys and data. Both key, both t, chaotic but cute. πŸ™ˆ
  • val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t β€” transposes keys and data, but the result is a Stdlib.Set.Make(T).t t. 🫢
  • val print : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a t -> unit β€” prints a map. You give it a printer for 'a, a Format.formatter, and the map, and it does the printing thing. ✨
πŸ’€ Real talk though: disjoint_union will raise a Fatal_error on you if both maps have the same binding with non-equal values. So like, know that going in.

πŸ’– That's the whole page, bestie β€” every val, every signature, every vibe. πŸ¦‹

Signed off from the OCamldoc corner of the universe, dated 2026-06-22, page Identifiable.Map(3). πŸ’œβœ¨ Go forth and union responsibly. πŸŽ€

πŸ“¦ where this page comes from