Bool structure
August 11, 2026 ยท View on GitHub
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 scan : (char, 'a) reader -> (bool, 'a) reader 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".
scan
scan getc strm reads a bool value from a prefix of the character stream strm, after
skipping initial whitespace. Returns SOME (b, rest) if strm starts
with "true" or "false", NONE otherwise.
fromString
fromString s scans a bool value from a prefix of the string s, after skipping
initial whitespace. Returns SOME (true) if s starts with "true",
SOME (false) if it starts with "false", and NONE otherwise;
characters after the value are ignored. Equivalent to
StringCvt.scanString scan.
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.