Bool structure

June 6, 2026 ยท View on GitHub

Up to index

The Bool structure provides the boolean type and associated operations.

Specified by the Standard ML Basis Library.

Synopsis

datatype bool = false | true

val not : bool -> bool
val toString : bool -> string
val fromString : string -> bool option
val andalso : bool * bool -> bool
val orelse : bool * bool -> bool
val implies : bool * bool -> bool
val = : bool * bool -> bool
val <> : bool * bool -> bool
val < : bool * bool -> bool
val > : bool * bool -> bool

datatype bool

is the type of boolean values true and false.

not

not b (or b.not ()) returns the logical inverse of b.

toString

toString b (or b.toString ()) returns the string representation of b, either "true" or "false".

fromString

fromString s scans a bool value from the string s. Returns SOME (true) if s is "true", SOME (false) if s is "false", and NONE otherwise.

andalso

andalso (b1, b2) returns the logical conjunction of b1 and b2. Unlike the andalso keyword, always evaluates both arguments.

orelse

orelse (b1, b2) returns the logical disjunction of b1 and b2. Unlike the orelse keyword, always evaluates both arguments.

implies

implies (b1, b2) returns the logical implication of b1 and b2; that is, false only if b1 is true and b2 is false. Unlike the implies keyword, always evaluates both arguments.

=

b1 = b2 returns true if b1 and b2 are equal.

<>

b1 <> b2 returns true if b1 and b2 are not equal.

<

b1 < b2 returns true if b1 is false and b2 is true.

>

b1 > b2 returns true if b1 is true and b2 is false.