ImperativeIO
functor
functor ImperativeIO
( ... ) : IMPERATIVE_IO (* OPTIONAL *)
The optional ImperativeIO
functor can be used to implement (derive) an imperative-style stream I/O facility in terms of a lazy functional stream I/O facility. In the imperative style, input and output operations do not return a new stream each time but cause side-effects on their arguments. Most functions can raise the Io
exception for various reasons, including illegal or inconsistent parameters, IO failures, and attempts to do I/O on closed output streams.
The ImperativeIO
functor is not often needed, as the required BinIO
and TextIO
structures supply imperative-style I/O for most situations. It plays a useful role when the programmer needs to construct I/O facilities with element types other than char
or Word8.word
, or ones based on user-specified I/O primitives.
structure StreamIO : STREAM_IO
structure Vector : MONO_VECTOR
structure Array : MONO_ARRAY
sharing type StreamIO.elem = Vector.elem = Array.elem
sharing type StreamIO.vector = Vector.vector = Array.vector
structure StreamIO : STREAM_IO
StreamIO
and do a little extra bookkeeping.
IMPERATIVE_IO
,MONO_ARRAY
,MONO_VECTOR
,PrimIO
,STREAM_IO
,StreamIO
Generated October 02, 2003
Last Modified April 15, 1996
Comments to John Reppy.
This document may be distributed freely over the internet as long as the copyright notice and license terms below are prominently displayed within every machine-readable copy.
Copyright © 2003 AT&T and Lucent Technologies. All rights reserved.
Permission is granted for internet users to make one paper copy for their
own personal use. Further hardcopy reproduction is strictly prohibited.
Permission to distribute the HTML document electronically on any medium
other than the internet must be requested from the copyright holders by
contacting the editors.
Printed versions of the SML Basis Manual are available from Cambridge
University Press.
To order, please visit
www.cup.org (North America) or
www.cup.cam.ac.uk (outside North America). |