Set.OrderedType(3)

okay so bestie, welcome to the Set.OrderedType(3) page from the OCaml library — it’s giving “input signature of the functor Set.Make” energy, and we’re gonna read it together like the main characters we are 💅✨

💖 NAME 💖

Set.OrderedType — input signature of the functor Set.Make. that’s the whole name situation, no cap 🎀

🧚 Module type 🧚

Module type Set.OrderedType:

Module type Set.OrderedType

✨ Documentation ✨

here’s the actual module type, bestie:

Module type OrderedType
 = sig end

it’s the input signature of the functor Set.Make — yes, that Set.Make, the icon 👑

🌸 the type 🌸

type t

t is the type of the set elements. literally the element type, that’s it, that’s the vibe 🦋

🔥 compare 🔥

val compare : t -> t -> int

compare is a total ordering function over the set elements. it’s a two-argument function f such that:

  • f e1 e2 is zero if the elements e1 and e2 are equal
  • f e1 e2 is strictly negative if e1 is smaller than e2
  • f e1 e2 is strictly positive if e1 is greater than e2

Example: a suitable ordering function is the generic structural comparison function compare. yes, the function is also named compare, stay with me 😭💖

lowkey important: total ordering function, okay? equal goes to zero, smaller goes negative, bigger goes positive. that’s the whole contract, periodt 🫶

mwah 💋 this iconic page came from source/version OCamldoc, dated 2026-06-22, and the footer title is Set.OrderedType(3). go be the main character of your own sets 🌈👑

📦 where this page comes from