Stdlib.Bool(3)
π¦ NAME
Stdlib.Bool β bestie, the description is literally "no description" π that's it, that's the whole entry, and honestly? iconic minimalism. It's part of the OCaml library (manual section 3) π
π Module
The module in question: Stdlib.Bool β¨
π Documentation
π§ Module Bool
So this whole thing is : (module Stdlib__Bool) β that's the exact line, no cap:
: (module Stdlib__Bool)
Okay so let's get into the actual booleans π
πΈ Booleans
type t = bool =
| false
| true
This is the type of booleans β truth values, yes/no, the whole vibe check of logic π«Ά
Now listen: the constructors false and true are included here so that they have paths, but heads up β they are not intended to be used in user-defined data types. So don't go building your own variant and sneaking them in there, that's not the move π
val not : bool -> bool
not b is the boolean negation of b β flips the vibe entirely, flip flopper behavior π
val (&&) : bool -> bool -> bool
e0 && e1 is the lazy boolean conjunction of expressions e0 and e1. And ooh, the key part: if e0 evaluates to false, then e1 is not evaluated β short circuit, she's efficient, she's not doing extra work for nobody β¨
Also: right-associative operator at precedence level 3/11 β yes, 3/11, exactly that, write it down π
val (||) : bool -> bool -> bool
e0 || e1 is the lazy boolean disjunction of expressions e0 and e1. And if e0 evaluates to true, then e1 is not evaluated β again, why would she π
Also again: right-associative operator at precedence level 2/11 β
val logand : bool -> bool -> bool
logand b1 b2 is true if and only if b1 and b2 are both true π«Ά
val logor : bool -> bool -> bool
logor b1 b2 is true if and only if either b1 or b2 is true π
val logxor : bool -> bool -> bool
logxor b1 b2 is true if exactly one of b1 and b2 is true β exactly one, she does not share, it's giving exclusive π
π Predicates and comparisons
val equal : bool -> bool -> bool
equal b0 b1 is true if and only if b0 and b1 are both true or both false β matching energies only π
val compare : bool -> bool -> int
compare b0 b1 is a total order on boolean values. And the ranking is locked in: false is smaller than true π
π Converting
val to_int : bool -> int
to_int b is 0 if b is false and 1 if b is true π₯
val to_float : bool -> float
to_float b is 0. if b is false and 1. if b is true β yes those are floats with the little dot, don't come for me β
val to_string : bool -> string
to_string b is "true" if b is true and "false" if b is false πΈ
val seeded_hash : int -> bool -> int
A seeded hash function for booleans, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded π§
Since 5.1 β¨
val hash : bool -> int
An unseeded hash function for booleans, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make π¦
Since 5.1 β¨
Literally the entire boolean alphabet in one module and she ate every single time π no notes.
Made with love by OCamldoc, dated 2026-06-22, and this page is Stdlib.Bool(3) β mwah, bye bestie ππ
π¦ where this page comes from
- arch rolling: ocaml 5.5.0-1 Β· LGPL2.1 AND custom: QPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms