Identifiable.S.Map(3)

πŸ’… Identifiable.S.Map(3) β€” the OCaml library page where maps get ✨identifiable✨

okay so bestie, welcome to Identifiable.S.Map(3) from the OCaml library manual πŸŽ€ this is the page for the Identifiable.S.Map module, and ngl it's a short one but it's lowkey iconic. let's get into it πŸ¦‹


🌸 NAME 🌸

Identifiable.S.Map β€” no description 😭 yeah that's it, that's the whole name section. she's mysterious. she's giving "no thoughts, head empty" but make it a manpage. πŸ™ˆ


🧚 Module 🧚

Module Identifiable.S.Map


✨ Documentation ✨

πŸ”₯ Module Map πŸ”₯

: sig end

okay so before we get to the fun stuff, we gotta meet the supporting cast:

  • module T : Map.OrderedType β€” this is the ordered-type module that makes the whole map thing work, iykyk πŸ‘‘
  • include Map.S β€” and boom, everything from Map.S is included in here too. she's standing on the shoulders of giants fr fr πŸ’–

🫢 The functions 🫢

🌈 val of_list : (key * 'a) list -> 'a t

builds you a map out of a list of key * 'a pairs. cute, simple, slay. ✨


🌈 val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Format.formatter -> 'a -> unit) -> 'a t -> 'a t -> 'a t

disjoint_union m1 m2 contains 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 πŸ’€ so like… she does NOT want your values disagreeing. keep it consistent or she WILL throw hands (well, throw an error). 😭


🌈 val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. and if some binding is present in both? the one from m2 is taken. m2 wins, periodt. πŸ‘‘ m2 is the main character here ngl.


🌈 val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

literally just flipping the script so m1 gets to be the main character instead. queen behavior. πŸ’…


🌈 val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t

you bring your own merge function and she merges with it. choose-your-own-adventure vibes fr fr 🌸


🌈 val rename : key t -> key -> key

renames a key. tiny, powerful, obsessed. πŸŽ€


🌈 val map_keys : (key -> key) -> 'a t -> 'a t

maps a function over all the keys. every single one. no key left behind bestie 🫢


🌈 val keys : 'a t -> Stdlib.Set.Make(T).t

hands you back all the keys as a Stdlib.Set.Make(T).t. a whole set of them. gorgeous πŸ’œ


🌈 val data : 'a t -> 'a list

and here's all the data as an 'a list, no keys, just vibes. πŸ¦‹


🌈 val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t

takes a set and a function from key to 'a and builds you a map. reverse-engineering the whole thing, iconic. ⭐


🌈 val transpose_keys_and_data : key t -> key t

flips keys and data around. wait, both are key here so like… it's a key t in and a key t out. symmetry! we love to see it ✨


🌈 val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t

same transpose energy, but the data comes out as a Stdlib.Set.Make(T).t instead. set-pilled πŸ’…


🌈 val print : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a t -> unit

you give her a printing function for your 'a values, a formatter, and a map, and she prints it out. curated, formatted, immaculate. πŸŽ€


ok bestie quick vibe check πŸ’– every single option and signature above is exactly as written β€” don't come for me if you typo one of those type signatures, she is picky about that fr fr 😭

and that's the whole page!! short and sweet, just how we like it. no cap, you now understand Identifiable.S.Map better than like 90% of people. slay. πŸ’…βœ¨

this page came to you courtesy of OCamldoc, dated 2026-06-22 β€” mwah, thanks for reading bestie, ily πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from