package containers

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v2.8.1.tar.gz
md5=d84e09c5d0abc501aa17cd502e31a038
sha512=8b832f4ada6035e80d81be0cfb7bdffb695ec67d465ed6097a144019e2b8a8f909095e78019c3da2d8181cc3cd730cd48f7519e87d3162442562103b7f36aabb

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
31
32
(* This file is free software, part of containers. See file "license" for more details. *)

open CCShims_

type t = bool

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

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

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

(*$=
  1 (to_int true)
  0 (to_int false)
*)

let of_int x : t = x<>0

(*$=
  true (of_int 1)
  false (of_int 0)
  true (of_int 42)
  true (of_int max_int)
  true (of_int min_int)
*)

let negate = not

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

let pp = Format.pp_print_bool