プログラミング言語SML#解説 4.0.0版
26 Standard ML標準ライブラリ

26.3 BIN_IO

バイト列に対するIO処理を提供する. 手続き型IOのシグネチャ IMPERATIVE_IO26.4)の拡張として定義される.

signature BIN_IO =
sig
  include IMPERATIVE_IO
    where type StreamIO.elem = Word8.word
    where type StreamIO.pos = BinPrimIO.pos
    where type StreamIO.reader = BinPrimIO.reader
    where type StreamIO.writer = BinPrimIO.writer
    where type StreamIO.vector = Word8Vector.vector
  val openAppend : string -> outstream
  val openIn : string -> instream
  val openOut : string -> outstream
end

シグネチャを実装するストラクチャ

  • BinIO :> BIN_IO

    structure StreamIO = struct
      type elem = word8
      type instream (= boxed)
      type out_pos (= boxed)
      type outstream (= boxed)
      type pos = Position.int
      type reader (= boxed)
      type vector = word8 vector
      type writer (= boxed)
    end
    type elem = word8
    type instream (= boxed)
    type outstream (= boxed)
    type vector = word8 vector