The Standard ML Basis Library


The ImperativeIO functor

The optional ImperativeIO functor can be used to implement (derive) an imperative-style stream IO facility in terms of a lazy functional stream IO facility. In the imperative style, input and output operations do not return a new stream each time but side-effect their arguments. Most functions can raise the Io exception for various reasons, including illegal or inconsistent parameters, IO failures, and attempts to do IO on closed streams.

The ImperativeIO functor is not often needed, as the required BinIO and TextIO structures supply imperative-style IO for most situations. It plays a useful role when the programmer needs to construct IO facilities with element types other than char or Word8.word, or ones based on user-specified IO primitives.


Synopsis

functor ImperativeIO ( ... ) : IMPERATIVE_IO

Functor argument interface

structure StreamIO : STREAM_IO
structure Vector : MONO_VECTOR
structure Array : MONO_ARRAY
sharing StreamIO.elem = Vector.elem = Array.elem
sharing StreamIO.vector = Vector.vector = Array.vector

Description

structure StreamIO
The particular functional stream IO facility from which this imperative IO facility is derived. Most functions just call functions in StreamIO and do a little extra bookkeeping.

structure Vector

structure Array

sharing StreamIO.elem
sharing StreamIO.vector


See Also

STREAM_IO, IMPERATIVE_IO, StreamIO

[ INDEX | TOP | Parent | Root ]

Last Modified April 15, 1996
Comments to John Reppy.
Copyright © 1997 Bell Labs, Lucent Technologies