The Standard ML Basis Library

The StreamIO functor


functor StreamIO ( ... ) : STREAM_IO  (* OPTIONAL *)

The optional StreamIO functor provides a way to build a Stream I/O layer on top of an arbitrary Primitive I/O implementation. For example, given an implementation of readers and writers for pairs of integers, one can define streams of pairs of integers.

Functor argument interface

structure PrimIO : PRIM_IO
structure Vector : MONO_VECTOR
structure Array : MONO_ARRAY
sharing type PrimIO.elem = Vector.elem = Array.elem
sharing type PrimIO.vector = Vector.vector = Array.vector
sharing type PrimIO.array = Array.array
val someElem : PrimIO.elem


structure PrimIO : PRIM_IO
The underlying primitive I/O structure.

val someElem : PrimIO.elem
Some arbitrary element used to initialize buffer arrays.

See Also



The Vector and Array structures provide vector and array operations for manipulating the vectors and arrays used in PrimIO and StreamIO. The element someElem is used to initialize buffer arrays; any element will do.

The types instream and outstream in the result of the StreamIO functor must be abstract.

Implementation note:

Here are some suggestions for efficient performance:

[ Top | Parent | Contents | Index | Root ]

Generated April 12, 2004
Last Modified May 10, 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 © 2004 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 (North America) or (outside North America).