The Standard ML Basis Library


The Bool structure

The Bool structure provides some basic operations on boolean values.


Synopsis

signature BOOL
structure Bool : BOOL

Interface

datatype bool = datatype bool
val not : bool -> bool
val fromString : string -> bool option
val scan : (char, 'a) StringCvt.reader -> 'a -> (bool * 'a) option
val toString : bool -> string

Description

datatype bool

not b
returns the logical negation of the boolean value b.

fromString s
scan getc strm
scan a boolean value from a stream of characters. Ignoring case and initial whitespace, the sequences "true" and "false" are converted to the corresponding boolean values, respectively.

The function fromString takes a string s as its source of characters. It returns SOME b for a scanned value b; otherwise it returns NONE. Note that the function fromString is equivalent to StringCvt.scanString scan.

The function scan takes a character stream reader getc and a stream strm. On successful scanning of a boolean value, it returns SOME(b, strm'), where b is the scanned value and strm' is the remaining character stream. The type of scan can also be written as (char, 'a) StringCvt.reader -> (bool, 'a) StringCvt.reader.

toString b
returns the string representation, which is either "true" or "false", of the boolean value b.


See Also

StringCvt

[ INDEX | TOP | Parent | Root ]

Last Modified February 25, 1997
Comments to John Reppy.
Copyright © 1997 Bell Labs, Lucent Technologies