package containers

  1. Overview
  2. Docs
A modular, clean and powerful extension of the OCaml standard library

Install

Dune Dependency

Authors

Maintainers

Sources

containers-3.16.tbz
sha256=1e7992cb2e59c0d2290d1b6c3a31531b3f310be6170b8ef3dde17ccd876b5b79
sha512=bb124e69ad0690f88393e18eee499be07761e767593558867aab32f643466b43258ced503170b154ca3b56dbd68987abd6d9438cf473707ec9866511589a5b84

doc/src/containers/CCBool.ml.html

Source file CCBool.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(* This file is free software, part of containers. See file "license" for more details. *)

type t = bool

let equal (a : bool) b = Stdlib.( = ) a b
let compare (a : bool) b = Stdlib.compare a b

let if_then f x =
  if x then
    Some (f ())
  else
    None

let if_then_else f g x =
  if x then
    f ()
  else
    g ()

let to_int (x : bool) : int =
  if x then
    1
  else
    0

let of_int x : t = x <> 0

type 'a printer = Format.formatter -> 'a -> unit

let pp = Format.pp_print_bool
OCaml

Innovation. Community. Security.