package batteries

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Operations on booleans

  • author Gabriel Scherer
  • author David Teller
type t = bool

The type of booleans. Formally, this is defined as type t = true | false

val not : bool -> bool

The boolean negation.

val (&&) : bool -> bool -> bool

The boolean ``and''. Evaluation is sequential, left-to-right: in e1 && e2, e1 is evaluated first, and if it returns false, e2 is not evaluated at all.

val (||) : bool -> bool -> bool

The boolean ``or''. Evaluation is sequential, left-to-right: in e1 || e2, e1 is evaluated first, and if it returns true, e2 is not evaluated at all.

val zero : bool
val one : bool
val neg : bool -> bool
val succ : bool -> bool
val pred : bool -> bool
val abs : bool -> bool
val add : bool -> bool -> bool
val mul : bool -> bool -> bool
val sub : bool -> bool -> bool
val div : t -> t -> t
val modulo : t -> t -> t
val pow : t -> t -> t
val min_num : bool
val max_num : bool
val compare : bool -> bool -> int
val equal : bool -> bool -> bool
val ord : bool -> bool -> BatOrd.order
val of_int : int -> bool

anything but 0 is true

val to_int : bool -> int

anything but 0 is true

val of_string : string -> bool

Convert the given string to a boolean.

  • raises Invalid_argument

    if the string is not "true", "false", "0", "1", "tt" or "ff".

val to_string : bool -> string
val of_float : float -> bool

0., nan +infinity and -infiity are false. The other values convert to true

val to_float : bool -> float

0., nan +infinity and -infiity are false. The other values convert to true

val (+) : t -> t -> t
val (-) : t -> t -> t
val (*) : t -> t -> t
val (/) : t -> t -> t
val (**) : t -> t -> t
val (--) : t -> t -> t BatEnum.t
val (---) : t -> t -> t BatEnum.t
val operations : t BatNumber.numeric
Submodules grouping all infix operators
module Infix : BatNumber.Infix with type bat__infix_t = t
Boilerplate code
val print : 'a BatInnerIO.output -> t -> unit

Printing

OCaml

Innovation. Community. Security.